:root {
  --bg: #0b0e14;
  --panel: #131823;
  --panel-2: #1a2130;
  --line: #262f42;
  --text: #e6e9f0;
  --muted: #8a93a6;
  --gold: #c8aa6e;
  --live: #ff4655;
  --win: #3d8bfd;
  --win-bg: rgba(61, 139, 253, .12);
  --loss: #e5484d;
  --loss-bg: rgba(229, 72, 77, .12);
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
button {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 14px; cursor: pointer;
}
button:hover { border-color: var(--gold); }
button.primary { background: var(--gold); color: #111; border-color: var(--gold); font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: var(--loss); background: transparent; }
img { display: block; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--loss); font-size: 12px; margin: 6px 0 0; min-height: 1em; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 14px 24px; background: rgba(11, 14, 20, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.logo { width: 14px; height: 14px; transform: rotate(45deg); border: 2px solid var(--gold); }
.stats { display: flex; gap: 16px; color: var(--muted); }
.stats b { color: var(--text); }
.stats .live-count b { color: var(--live); }
.actions { margin-left: auto; display: flex; gap: 8px; }
.banner { margin: 16px 24px 0; padding: 10px 14px; border-radius: 8px; background: rgba(200, 170, 110, .12); color: var(--gold); }

.tabs { display: flex; gap: 6px; padding: 16px 24px 0; }
.tabs button { border-radius: 999px; padding: 5px 16px; background: transparent; }
.tabs button.on { background: var(--panel-2); border-color: var(--gold); color: var(--gold); }

.grid { display: grid; gap: 14px; padding: 16px 24px 40px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.empty { color: var(--muted); padding: 40px 0; grid-column: 1 / -1; text-align: center; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  cursor: pointer; transition: border-color .15s, transform .15s; display: flex; flex-direction: column; gap: 10px;
}
.card:hover { border-color: #3a4560; transform: translateY(-1px); }
.card.live { border-color: rgba(255, 70, 85, .55); box-shadow: 0 0 0 1px rgba(255, 70, 85, .15), 0 8px 24px rgba(255, 70, 85, .08); }
.card-top { display: flex; align-items: center; gap: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel-2); }
.who { min-width: 0; flex: 1; }
.name { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rid { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; margin-right: 5px; border-radius: 4px; background: var(--panel-2); color: var(--gold); }
.tabs { flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.off { color: var(--muted); background: var(--panel-2); font-weight: 500; }
.badge.on { color: #fff; background: var(--live); display: inline-flex; align-items: center; gap: 5px; letter-spacing: .5px; }
.badge.on i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.rank { font-size: 13px; }
.tier { color: var(--gold); font-weight: 600; }

.live-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(255, 70, 85, .07); }
.champ { width: 44px; height: 44px; border-radius: 8px; }
.champ-name { font-weight: 600; }
.timer { color: var(--live); font-variant-numeric: tabular-nums; font-weight: 600; }
.icons { display: flex; gap: 3px; margin-left: auto; }
.icons img { width: 22px; height: 22px; border-radius: 4px; }
.icons .rune { background: #000; border-radius: 50%; }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 20; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 100%); overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--line); padding: 20px 24px 40px;
}
.d-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.d-head .avatar { width: 60px; height: 60px; }
.d-head h2 { margin: 0; font-size: 20px; }
.d-head .close { margin-left: auto; }
section { margin-top: 22px; }
section h3 { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .5px; margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
section h3 select { margin-left: auto; }
select, input {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}


.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border-radius: 10px; padding: 12px; }
.tile .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--muted); font-size: 12px; }
.form { display: flex; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.form span { width: 18px; height: 18px; border-radius: 4px; font-size: 10px; display: grid; place-items: center; font-weight: 700; }
.form .w { background: var(--win-bg); color: var(--win); }
.form .l { background: var(--loss-bg); color: var(--loss); }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 7px 8px; text-align: left; font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--line); }
tr + tr td { border-top: 1px solid var(--line); }
.cname { display: flex; align-items: center; gap: 8px; }
.cname img { width: 28px; height: 28px; border-radius: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--loss-bg); width: 90px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.bar i { display: block; height: 100%; background: var(--win); }

.match { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; border-left: 4px solid; }
.match.w { background: var(--win-bg); border-color: var(--win); }
.match.l { background: var(--loss-bg); border-color: var(--loss); }
.match.r { background: var(--panel); border-color: var(--muted); }
.match .res { width: 40px; font-weight: 700; font-size: 12px; }
.match.w .res { color: var(--win); }
.match.l .res { color: var(--loss); }
.match img.c { width: 40px; height: 40px; border-radius: 8px; }
.match .kda { width: 110px; }
.match .kda b { font-size: 15px; }
.match .meta { width: 90px; font-size: 12px; color: var(--muted); }
.items { display: flex; gap: 2px; margin-left: auto; }
.items img, .items i { width: 24px; height: 24px; border-radius: 4px; background: var(--panel-2); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(380px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h3 { margin: 0 0 14px; }
dialog label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast { background: var(--panel-2); border: 1px solid var(--live); border-radius: 10px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.toast img { width: 32px; height: 32px; border-radius: 6px; }

@media (max-width: 640px) {
  .top, .grid, .tabs { padding-left: 16px; padding-right: 16px; }
  .actions { margin-left: 0; }
  .match .meta, .items { display: none; }
}

/* live game */
.modal { position: fixed; inset: 0; z-index: 25; display: grid; place-items: start center; overflow-y: auto; padding: 40px 16px; }
.game-panel { position: relative; width: min(1280px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.g-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.g-head h2 { margin: 0; font-size: 17px; }
.g-head .sep { width: 1px; height: 16px; background: var(--line); }
.g-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-watch { background: #4c7dff; border: 1px solid #4c7dff; color: #fff; font-weight: 600; text-decoration: none; padding: 7px 18px; border-radius: 8px; }
.btn-watch:hover { filter: brightness(1.1); }
.g-dir { width: 240px; font-size: 12px; padding: 5px 8px; }
.pro-tag { font-size: 11px; color: #111; background: var(--gold); padding: 0 6px; border-radius: 4px; margin-left: 6px; font-weight: 700; }
.live-row { cursor: zoom-in; }

/* status */
.badge.unk { color: var(--muted); background: transparent; border: 1px dashed var(--line); font-weight: 500; }
.badge.other { color: #111; background: #e0a84a; display: inline-flex; align-items: center; gap: 5px; }
.badge.other i { width: 6px; height: 6px; border-radius: 50%; background: #111; }
.card.live-other { border-color: rgba(224, 168, 74, .45); }
.card.live-other .live-row { background: rgba(224, 168, 74, .08); }
.card.live-other .timer { color: #e0a84a; }
.stats { align-items: baseline; flex-wrap: wrap; }
.stats .unk-count b { color: var(--muted); }

/* 抽屉里的精简对局 */
.mini-board { background: var(--panel); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.mini-board button { align-self: flex-start; margin-top: 2px; }
.mini-team { display: flex; align-items: center; gap: 6px; }
.mini-label { width: 46px; font-size: 12px; font-weight: 600; }
.mini-team.blue .mini-label { color: var(--win); }
.mini-team.red .mini-label { color: var(--loss); }
.mini-champ img { width: 32px; height: 32px; border-radius: 6px; border: 2px solid transparent; }
.mini-champ.pro img { border-color: var(--gold); }
.mini-champ.me img { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(200, 170, 110, .35); }
.bans { display: flex; gap: 3px; }
.bans img { width: 20px; height: 20px; border-radius: 4px; filter: grayscale(1); opacity: .55; }

/* 对局计分板：蓝左红右，逐行对齐，窄屏横向滚动 */
.g-scroll { overflow-x: auto; }
.g-board { display: grid; grid-template-columns: repeat(2, minmax(420px, 1fr)); }
.g-board > :nth-child(odd) { border-right: 1px solid var(--line); }
.g-team-head { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.g-team-head.blue b { color: var(--win); }
.g-team-head.red b { color: var(--loss); }
.g-team-head .bans { margin-left: auto; }
.gp { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icons who rk" "hist hist hist";
      column-gap: 10px; row-gap: 6px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.gp.empty { border-left: 0; }
.gp.blue.tracked { border-left-color: var(--win); background: rgba(61, 139, 253, .06); }
.gp.red.tracked { border-left-color: var(--loss); background: rgba(229, 72, 77, .06); }
.gp-icons { grid-area: icons; display: flex; gap: 3px; align-items: center; }
.gp-icons .c { width: 40px; height: 40px; border-radius: 50%; margin-right: 3px; }
.gp-icons .col { display: flex; flex-direction: column; gap: 2px; }
.gp-icons .col img { width: 18px; height: 18px; border-radius: 3px; }
.gp-icons .col img.rune { border-radius: 50%; background: #000; }
.gp-icons .col img.rune.sub { padding: 2px; }
.gp-who { grid-area: who; min-width: 0; }
.gp .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp .rk { grid-area: rk; font-size: 12px; text-align: right; white-space: nowrap; }
.gp .hist { grid-area: hist; display: flex; gap: 3px; align-items: center; min-height: 24px; }
.hist .h { display: flex; flex-direction: column; gap: 2px; }
.hist .h img { width: 20px; height: 20px; border-radius: 4px; }
.hist .h b { height: 3px; border-radius: 2px; background: var(--loss); }
.hist .h.w b { background: var(--win); }
.hist .sum { margin-left: 6px; font-size: 12px; color: var(--muted); }
.hist .sum b { color: var(--text); font-weight: 600; }
.hist .skel { width: 20px; height: 23px; border-radius: 4px; background: var(--panel-2); animation: pulse 1.2s infinite; }

/* 职业选手同局 */
.clashes { margin: 16px 24px 0; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.clashes h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.clash { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; flex-wrap: wrap; }
.clash + .clash { border-top: 1px solid var(--line); }
.clash:hover { background: var(--panel-2); }
.cl-kind { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cl-kind.vs { background: rgba(255, 70, 85, .15); color: var(--live); }
.cl-kind.duo { background: rgba(200, 170, 110, .18); color: var(--gold); }
.cl-side { display: flex; gap: 10px; flex-wrap: wrap; }
.cl-side.blue b { color: var(--win); }
.cl-side.red b { color: var(--loss); }
.cl-pro { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.cl-pro img { width: 24px; height: 24px; border-radius: 5px; }
.cl-vs { color: var(--muted); font-size: 11px; font-weight: 700; }
.clash .timer { color: inherit; }
.rel { display: flex; gap: 6px; flex-wrap: wrap; }
.rel-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.rel-chip.duo { background: rgba(200, 170, 110, .15); color: var(--gold); }
.rel-chip.vs { background: rgba(255, 70, 85, .12); color: var(--live); }
@media (max-width: 640px) { .clashes { margin: 16px 16px 0; } }

/* 平均段位 */
.lobby-avg { font-size: 13px; }
.lobby-avg b, .t-avg b { color: var(--gold); font-weight: 650; }
.t-avg { font-size: 12px; }
.t-up { font-size: 11px; color: var(--win); background: rgba(61, 139, 253, .12); padding: 1px 6px; border-radius: 999px; margin-left: 4px; }

.hist-load { font-size: 12px; padding: 3px 10px; background: transparent; color: var(--muted); border-style: dashed; }
.hist-load:hover { color: var(--text); }
