:root {
  --bg: #0b0e13;
  --card: #151a23;
  --card2: #11161e;
  --line: #232b39;
  --text: #e8ecf3;
  --muted: #8b98ab;
  --dim: #66738a;
  --accent: #3f8fd6;
  --accent2: #9b5cd6;
  --win: #3ddc97;
  --lose: #e2675f;
  --gold: #f0c36b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(520px 260px at 8% -8%, rgba(63,143,214,.22), transparent 70%),
    radial-gradient(460px 240px at 100% 0%, rgba(155,92,214,.16), transparent 70%),
    var(--bg);
  min-height: 100vh;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 14px calc(76px + env(safe-area-inset-bottom));
}

/* ── 顶部 ── */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 2px 10px;
  background: linear-gradient(180deg, rgba(11,14,19,.97) 62%, rgba(11,14,19,0));
  backdrop-filter: blur(8px);
}
.brand-row { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 2px 10px; }
.brand { font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.sub { font-size: 12px; color: var(--dim); }

.search { display: flex; gap: 8px; }
.search input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
.search input:focus { border-color: var(--accent); }
.search input::placeholder { color: #5f6c80; }
.search button {
  width: 58px;
  height: 46px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 0;
  border-radius: 12px;
}
.search button:active { transform: scale(.96); }

/* ── 状态 ── */
.state {
  margin: 60px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.state.error { color: var(--lose); }
.state .sub { display: block; margin-top: 6px; font-size: 12px; color: var(--dim); }

/* ── 玩家头 ── */
.player { display: flex; align-items: flex-end; gap: 10px; padding: 6px 2px 14px; flex-wrap: wrap; }
.player .name { font-size: 27px; font-weight: 700; line-height: 1.15; }
.player .lv { font-size: 13px; color: var(--muted); }
.pill {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.online { color: var(--win); border-color: rgba(61,220,151,.4); background: rgba(61,220,151,.08); }
.player .season { margin-left: auto; font-size: 11px; color: var(--dim); }

/* ── 段位/统计 ── */
.ranks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rank {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
}
.rank .label { font-size: 11px; color: var(--dim); letter-spacing: .5px; }
.rank .name { font-size: 21px; font-weight: 700; margin-top: 6px; }
.rank .extra { font-size: 12px; color: var(--muted); margin-top: 5px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 6px;
  text-align: center;
}
.stat .k { font-size: 11px; color: var(--dim); }
.stat .v { font-size: 19px; font-weight: 700; margin-top: 4px; }
.stat .s { font-size: 10px; color: var(--dim); margin-top: 2px; }

/* ── 区块 ── */
.sec { margin-top: 20px; }
.sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: #c7d1e0;
  margin: 0 2px 9px;
}
.sec-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); }

/* ── 对局 ── */
.match {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  grid-template-areas: "res main kda" "res meta score";
  gap: 3px 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--card);
  border-radius: 11px;
  border-left: 3px solid var(--lose);
}
.match.win { border-left-color: var(--win); }
.match .res { grid-area: res; align-self: center; font-size: 12px; font-weight: 700; color: var(--lose); }
.match.win .res { color: var(--win); }
.match .main { grid-area: main; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .meta { grid-area: meta; font-size: 11px; color: var(--dim); }
.match .kda { grid-area: kda; font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.match .kda b { color: var(--text); font-size: 13px; }
.match .score { grid-area: score; font-size: 13px; font-weight: 700; text-align: right; white-space: nowrap; }
.match .score i { font-style: normal; color: var(--dim); font-weight: 400; margin: 0 2px; }
.tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid rgba(240,195,107,.45);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 5px;
  vertical-align: 1px;
}
.delta-up { color: var(--win); }
.delta-down { color: var(--lose); }

/* ── 模式表 ── */
.modes { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
.modes th, .modes td { padding: 9px 8px; font-size: 12px; text-align: right; border-bottom: 1px solid #1e2531; }
.modes th { color: var(--dim); font-weight: 400; font-size: 11px; }
.modes tr:last-child td { border-bottom: 0; }
.modes th:first-child, .modes td:first-child { text-align: left; padding-left: 12px; }
.modes td:last-child, .modes th:last-child { padding-right: 12px; }

/* ── 角色 ── */
.role { display: grid; grid-template-columns: 70px 1fr 54px 52px; align-items: center; gap: 8px; padding: 8px 11px; margin-bottom: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.role .rn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role .bar { height: 5px; background: #202836; border-radius: 3px; overflow: hidden; }
.role .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.role .cnt { color: var(--muted); text-align: right; }
.role .wr { text-align: right; }

.good { color: var(--win); }
.bad { color: var(--lose); }
.foot { margin-top: 18px; text-align: center; font-size: 11px; color: var(--dim); line-height: 1.7; }
.foot a { color: #6f9dd8; text-decoration: none; }

/* ── 底部 Tab ── */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  gap: 8px;
  background: rgba(11,14,19,.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.tabs button {
  flex: 1;
  height: 44px;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
}
.tabs button.active { color: #fff; background: var(--card); border-color: var(--line); }
