:root {
  --bg: #0e1420;
  --card: #1a2332;
  --card2: #222d40;
  --border: #2c3a50;
  --text: #e6edf6;
  --muted: #8a97ab;
  --accent: #2e6ff2;
  --accent2: #4a8bff;
  --win: #4ecdc4;
  --lose: #ff6b6b;
  --gold: #f5c542;
  --purple: #b58cff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 20px 16px;
}

.wrap { max-width: 1200px; margin: 0 auto; }

/* ============ 顶部栏：导航 + 搜索框（首页/详情两种模式） ============ */
.topbar { display: flex; flex-wrap: wrap; align-items: center; }
.topnav {
  display: flex; align-items: center; gap: 4px;
}
.nav-item {
  color: var(--muted);
  font-size: 15px; font-weight: 600;
  padding: 8px 16px; border-radius: 8px;
  cursor: pointer; text-decoration: none;
  transition: color .15s, background .15s;
}
.nav-item:hover { color: var(--text); background: var(--card2); }
.nav-item.active { color: var(--accent2); background: var(--card); }

/* 首页模式：导航占一行，搜索框下面居中、下移 */
.topbar.home .topnav { flex-basis: 100%; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.topbar.home .search-bar { flex-basis: 100%; margin-top: 56px; margin-bottom: 12px; }
/* 详情模式：同一行，搜索框缩小移到右上角，提示文字隐藏 */
.topbar.profile .topnav { margin-right: auto; }
.topbar.profile .search-bar { margin-left: auto; width: 360px; }
.topbar.profile .hint { display: none; }
.topbar.profile .search-pill { padding: 2px 4px 2px 2px; }
.topbar.profile #query { font-size: 13px; padding: 7px 10px; }
.topbar.profile #regionBtn { padding: 5px 10px; font-size: 12px; }
.topbar.profile { margin-bottom: 26px; }  /* 与下方玩家横幅拉开距离 */

/* 搜索栏：OP.GG 胶囊样式 */
.search-bar { display: flex; flex-direction: column; align-items: center; }

/* ============ 收藏星标 ============ */
.fav-star {
  border: none; background: transparent;
  font-size: 20px; line-height: 1; cursor: pointer;
  color: var(--muted);
  padding: 0 4px; vertical-align: middle;
  transition: color .15s, transform .15s;
}
.fav-star:hover { color: var(--gold); transform: scale(1.15); }
.fav-star.on { color: var(--gold); }

.head-refresh {
  border: none; background: transparent;
  font-size: 18px; line-height: 1; cursor: pointer;
  color: var(--muted); padding: 0 6px; vertical-align: middle;
  transition: color .15s, transform .3s;
}
.head-refresh:hover { color: var(--accent2); transform: rotate(180deg); }

/* ============ 收藏列表 ============ */
.fav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--card2); border: 1px solid var(--border);
  margin-bottom: 8px;
}
.fav-name { font-size: 14px; font-weight: 600; color: var(--text); }
.fav-region { font-size: 12px; color: var(--muted); flex: 1; }
.fav-go, .fav-del {
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 13px; padding: 5px 14px;
  border-radius: 6px; cursor: pointer; transition: all .15s;
}
.fav-go:hover { border-color: var(--accent2); color: var(--accent2); }
.fav-del:hover { border-color: var(--lose); color: var(--lose); }

/* ============ 单双排排行榜 ============ */
.lb-building {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 8px; color: var(--muted); font-size: 14px;
}
.lb-tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.lb-tab {
  border: 1px solid var(--border); background: var(--card2);
  color: var(--muted); font-size: 13px; padding: 5px 16px;
  border-radius: 999px; cursor: pointer; transition: all .15s;
}
.lb-tab:hover { color: var(--text); }
.lb-tab.on { color: var(--accent2); border-color: var(--accent2); background: rgba(74,139,255,.1); }
.lb-updated { margin-left: auto; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lb-table th {
  text-align: left; color: var(--muted); font-size: 12px; font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.lb-table td { padding: 8px 10px; border-bottom: 1px solid rgba(44,58,80,.5); }
.lb-table tr:hover td { background: var(--card2); }
.lb-rank { color: var(--muted); width: 44px; font-weight: 600; }
.lb-summoner { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-tag {
  font-size: 10px; font-weight: 600; color: #fff;
  border-radius: 3px; padding: 1px 5px; flex-shrink: 0;
}
.lb-tag.pro { background: #8a6cff; }
.lb-tag.streamer { background: #c8a24a; }
.lb-art { color: var(--gold); font-size: 12px; font-weight: 600; flex-shrink: 0; }
.lb-name {
  color: var(--text); cursor: pointer; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-name:hover { color: var(--accent2); text-decoration: underline; }
.lb-tier { color: var(--gold); font-weight: 600; }
.lb-lp { color: var(--accent2); font-weight: 600; }
.lb-level, .lb-more { color: var(--muted); }
.lb-more { margin-top: 12px; text-align: center; }
.lb-more-btn {
  border: 1px solid var(--border); background: var(--card2);
  color: var(--accent2); font-size: 13px; padding: 8px 24px;
  border-radius: 999px; cursor: pointer; transition: all .15s;
}
.lb-more-btn:hover { border-color: var(--accent2); }

/* 搜索栏：OP.GG 胶囊样式（位置/尺寸由 .topbar 两种模式控制） */
.search-pill {
  position: relative;
  display: flex; align-items: center;
  width: 100%; max-width: 480px;
  background: var(--card);
  border: 2px solid var(--accent2);
  border-radius: 999px;
  padding: 4px 6px 4px 4px;
  transition: border .2s;
}
.search-pill:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74,139,255,.15); }
#regionBtn {
  display: flex; align-items: center; gap: 4px;
  border: none; color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px; font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}
.rb-arrow { font-size: 10px; opacity: .9; }
#query {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
}
#query::placeholder { color: var(--muted); }
.search-icon {
  border: none; background: transparent;
  font-size: 17px; cursor: pointer;
  padding: 6px 10px; border-radius: 50%;
  flex-shrink: 0;
}
.search-icon:hover { background: var(--card2); }

/* 区服九宫格下拉 */
.region-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  display: none;
  grid-template-columns: repeat(3, 74px);
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.region-chip {
  color: #fff; font-size: 12px; font-weight: 800;
  text-align: center; padding: 10px 0;
  border-radius: 10px;
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s, transform .15s;
}
.region-chip:hover { opacity: .85; transform: translateY(-1px); }
.region-chip.active { opacity: 1; outline: 2px solid #fff; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; text-align: center; }

.loading {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 24px; color: var(--muted);
}
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  background: rgba(255,107,107,.12);
  border: 1px solid rgba(255,107,107,.4);
  color: var(--lose);
  padding: 14px 18px; border-radius: 8px; margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

/* ============ 顶部横幅 ============ */
.head-card { padding: 20px 24px; }
.head-row { display: flex; align-items: center; gap: 20px; }
.head-avatar-wrap { position: relative; flex-shrink: 0; }
.head-avatar {
  width: 88px; height: 88px; border-radius: 14px; object-fit: cover;
  border: 2px solid var(--border); background: var(--card2); display: block;
}
.head-level {
  position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; font-size: 12px; font-weight: 700; padding: 1px 10px;
  white-space: nowrap;
}
.head-name { font-size: 26px; font-weight: 800; }
.head-tag { color: var(--muted); font-weight: 600; font-size: 20px; }
.head-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ID 下面的主播/职业标签行（参考 OP.GG：[主播] 艺名 [🏠]） */
.head-tags-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.head-tags-row .pl-tag { margin-left: 0; font-size: 12px; padding: 2px 9px; }
.head-tags-row .tag-name { font-size: 14px; font-weight: 600; color: var(--text); }
.head-tags-row .pl-link { color: #3ddc84; }
.head-tags-row .pl-link svg { width: 18px; height: 18px; }

/* ============ 左右布局 ============ */
.layout { display: flex; gap: 14px; align-items: flex-start; }
.side { width: 270px; flex-shrink: 0; }
.main { flex: 1; min-width: 0; }
.side-card { padding: 16px; }

.side-title {
  font-size: 14px; font-weight: 700; margin-bottom: 12px;
  border-left: 3px solid var(--accent); padding-left: 8px;
}
.muted-sm { color: var(--muted); font-size: 11px; font-weight: 400; }

/* 段位卡 */
.rank-big { font-size: 26px; font-weight: 800; color: var(--gold); margin: 8px 0 2px; }
.rank-lp { font-size: 15px; color: var(--accent2); font-weight: 600; }
.rank-stats {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 12px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.wr-b { color: var(--text); font-weight: 600; }

/* 英雄胜率列表 */
.cr-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 6px; border-radius: 8px;
}
.cr-row:hover { background: var(--card2); }
.cr-icon {
  width: 34px; height: 34px; border-radius: 7px; object-fit: cover;
  background: var(--card2); flex-shrink: 0; display: block;
}
.cr-icon.txt {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
}
.cr-mid { flex: 1; min-width: 0; }
.cr-name { font-size: 13px; font-weight: 600; }
.cr-kda { color: var(--muted); font-size: 11px; margin-top: 1px; }
.cr-wr { font-size: 14px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.cr-wr.good { color: var(--win); }
.cr-wr.bad { color: var(--lose); }

/* ============ 右侧汇总卡 ============ */
.sum-row { display: flex; align-items: center; gap: 34px; padding: 6px 10px; }
.sum-ring {
  width: 92px; height: 92px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sum-ring-in {
  width: 70px; height: 70px; border-radius: 50%;
  background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.sum-ring-in b { font-size: 19px; }
.sum-ring-in span { font-size: 10px; color: var(--muted); }
.sum-item { text-align: center; }
.sum-big { font-size: 24px; font-weight: 800; }
.sum-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ============ 对局卡片 ============ */
.card-title {
  font-size: 16px; font-weight: 700; margin-bottom: 14px;
  border-left: 3px solid var(--accent); padding-left: 10px;
}
.match-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 8px; margin-bottom: 10px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--win);
  overflow: hidden;
}
.match-item.lose { border-left-color: var(--lose); }

.m-left { width: 96px; flex-shrink: 0; }
.m-queue { font-weight: 600; font-size: 13px; }
.match-item.win .m-queue { color: var(--win); }
.match-item.lose .m-queue { color: var(--lose); }
.m-time, .m-dur { color: var(--muted); font-size: 11px; margin-top: 2px; }
.m-res { font-size: 13px; font-weight: 700; margin-top: 4px; }
.m-res.win { color: var(--win); }
.m-res.lose { color: var(--lose); }
.badge {
  display: inline-block; margin-top: 4px; padding: 1px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 700; color: #fff;
}
.badge.svp { background: var(--purple); }
.badge.mvp { background: var(--gold); color: #333; }

.m-champ { width: 64px; flex-shrink: 0; text-align: center; }
.champ-wrap { position: relative; display: inline-block; }
.champ-img {
  width: 52px; height: 52px; border-radius: 8px; object-fit: cover;
  background: var(--bg); display: block;
}
.champ-img.txt, .pl-champ.txt {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 18px; background: var(--bg);
}
.champ-lv {
  position: absolute; right: -4px; bottom: -4px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: 10px; padding: 0 4px; color: var(--text);
}
.spells { display: flex; gap: 3px; justify-content: center; margin-top: 5px; }
.spell { width: 20px; height: 20px; border-radius: 4px; background: var(--bg); }

.m-kda { width: 108px; flex-shrink: 0; text-align: center; }
.kda-line { font-size: 17px; font-weight: 700; }
.kda-line .d { color: var(--lose); }
.kda-ratio { color: var(--muted); font-size: 11px; margin-top: 2px; }
.m-cs { color: var(--muted); font-size: 11px; margin-top: 2px; }

.m-items {
  display: grid; grid-template-columns: repeat(4, 26px);
  grid-auto-rows: 26px; gap: 3px; flex-shrink: 0;
}
.item {
  width: 26px; height: 26px; border-radius: 4px; object-fit: cover;
  background: var(--bg); display: block;
}
.item.empty { background: rgba(255,255,255,.04); }

.m-teams { display: flex; gap: 12px; flex: 1; min-width: 0; justify-content: flex-end; }
/* 固定列宽：无论有无"职业/主播"标签，每局两列宽度一致，跨局严格对齐 */
.team-col { display: flex; flex-direction: column; gap: 3px; width: 185px; flex-shrink: 0; }
.pl {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 6px; border-radius: 4px;
  cursor: pointer;
  transition: background .15s;
}
.pl:hover { background: rgba(255,255,255,.08); }
.pl.me { background: rgba(74,139,255,.18); outline: 1px solid rgba(74,139,255,.5); }
.pl-champ {
  width: 18px; height: 18px; border-radius: 3px; object-fit: cover;
  background: var(--bg); flex-shrink: 0;
}
.pl-champ.txt { font-size: 10px; }
.pl-name {
  font-size: 11px; color: var(--muted);
  width: 120px; flex-shrink: 0;
  text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pl.me .pl-name { color: var(--text); font-weight: 600; }
/* 职业/主播标签 + 直播间链接 */
.pl-tag {
  font-size: 10px; font-weight: 600; color: #fff;
  border-radius: 3px; padding: 1px 5px;
  flex-shrink: 0;
  margin-left: auto;
  line-height: 1.4;
}
.pl-tag.pro { background: #8a6cff; }       /* 职业：紫色（贴 OP.GG PRO） */
.pl-tag.streamer { background: #c8a24a; }  /* 主播：金色 */
.pl-link {
  display: inline-flex; align-items: center;
  color: #3ddc84;  /* 绿色房子图标（直播间） */
  margin-left: 3px; flex-shrink: 0;
  text-decoration: none;
}
.pl-link:hover { color: #5ef0a0; }

.foot {
  text-align: center; color: var(--muted); font-size: 12px;
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border);
}

/* 对局玩家加载进度提示 */
.team-progress {
  font-size: 12px; color: var(--muted);
  padding: 6px 2px 10px;
  display: flex; align-items: center; gap: 6px;
}
.team-progress::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent2);
  animation: spin .8s linear infinite; flex-shrink: 0;
}
.team-progress.done::before {
  border: none; animation: none; width: 12px; height: 12px;
  background: var(--win); border-radius: 50%;
}

/* 加载更多按钮 */
.load-more-wrap { text-align: center; padding: 8px 0 4px; }
.load-more-btn {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--accent2);
  padding: 10px 28px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.load-more-btn:hover { border-color: var(--accent2); background: rgba(74,139,255,.1); }
.load-more-btn:disabled { cursor: default; opacity: .7; }
.load-more-btn .mini-spinner {
  display: inline-block; vertical-align: -2px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent2);
  animation: spin .8s linear infinite; margin-right: 6px;
}

/* 窄屏：侧栏移到上方，10人列表换行 */
@media (max-width: 980px) {
  .layout { flex-direction: column; }
  .side { width: 100%; }
}
@media (max-width: 900px) {
  .match-item { flex-wrap: wrap; }
  .m-teams {
    width: 100%; flex-basis: 100%;
    justify-content: flex-start;
    border-top: 1px solid var(--border);
    padding-top: 10px; margin-top: 4px;
  }
  .team-col { flex: 1; min-width: 0; }
  .pl-name { max-width: none; }
}
@media (max-width: 600px) {
  .m-items { display: none; }
  .head-row { flex-direction: column; text-align: center; }
  .sum-row { gap: 18px; flex-wrap: wrap; justify-content: center; }
}
