:root {
  --bg: #0b0f16;
  --bg-2: #111826;
  --panel: rgba(22, 30, 45, 0.78);
  --panel-solid: #151d2c;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e8eef8;
  --text-dim: #9fb0c9;
  --text-faint: #6d7f99;
  --accent: #d9a441;
  --accent-2: #4bb3c9;
  --win: #4ec97a;
  --lose: #e0575f;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  --tier-hue: 190;
}

* { box-sizing: border-box; }

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

body { min-height: 100vh; overflow-x: hidden; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.bg-glow {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(50% 60% at 20% 10%, hsla(var(--tier-hue), 70%, 45%, 0.18), transparent 70%),
    radial-gradient(40% 50% at 85% 0%, rgba(217, 164, 65, 0.14), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
  transition: background 0.8s ease;
  z-index: 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 48px);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 13px;
  color: #0b0f16;
  background: linear-gradient(135deg, var(--accent), #f2cf7c);
  padding: 5px 9px;
  border-radius: 6px;
}
.brand-text { font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.brand-tag {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid rgba(217, 164, 65, 0.4);
  border-radius: 999px;
  padding: 1px 8px;
}

.topbar-actions { display: flex; gap: 8px; }

.ghost-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.ghost-btn:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.07); }

/* ---------- 搜索区 ---------- */
.hero {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(20px, 5vh, 56px) clamp(16px, 4vw, 32px) 8px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(24px, 3.6vw, 38px);
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, #fff 20%, var(--accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 26px; }

.search {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}
.search input {
  flex: 1;
  min-width: 0;
  background: rgba(10, 15, 24, 0.85);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.14); }
.search input::placeholder { color: var(--text-faint); }

.search button, .error-actions button, .key-row button {
  background: linear-gradient(135deg, var(--accent), #b9862c);
  color: #16110a;
  border: 0;
  border-radius: 10px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.search button:hover { filter: brightness(1.08); }
.search button:active { transform: translateY(1px); }
.search button:disabled { opacity: 0.55; cursor: not-allowed; }

.key-panel {
  max-width: 560px;
  margin: 18px auto 0;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.key-panel label { font-size: 13px; color: var(--text-dim); }
.key-row { display: flex; gap: 8px; margin: 8px 0; }
.key-row input {
  flex: 1;
  background: rgba(10, 15, 24, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}
.key-row button { padding: 9px 16px; font-size: 13px; }

.hint { color: var(--text-faint); font-size: 12px; margin: 6px 0 0; }

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 22px;
  color: var(--text-faint);
  font-size: 13px;
}
.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- 状态 ---------- */
.status {
  max-width: 560px;
  margin: 24px auto 0;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.status-line { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-dim); }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-inner {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.error-card {
  max-width: 560px;
  margin: 24px auto 0;
  padding: 20px 22px;
  background: rgba(60, 22, 26, 0.6);
  border: 1px solid rgba(224, 87, 95, 0.4);
  border-radius: var(--radius-sm);
}
.error-card h2 { margin: 0 0 8px; font-size: 16px; color: #ffb4b8; }
.error-card p { margin: 0 0 14px; color: var(--text-dim); font-size: 14px; white-space: pre-wrap; }
.error-actions { display: flex; gap: 10px; }
.error-actions button { padding: 9px 16px; font-size: 13.5px; }

/* ---------- 报告 ---------- */
#report {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 60px;
  display: grid;
  gap: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  backdrop-filter: blur(6px);
}
.card > h2 {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card > h2::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
}
.card-sub { color: var(--text-faint); font-size: 12.5px; margin: 0 0 16px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* 玩家 + 等级 */
.player-card {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.player-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 2px solid hsla(var(--tier-hue), 70%, 55%, 0.5);
  object-fit: cover;
  flex: none;
  background: var(--panel-solid);
}
.player-avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
  color: hsl(var(--tier-hue), 60%, 70%);
  background: radial-gradient(circle at 50% 30%, hsla(var(--tier-hue), 60%, 45%, 0.35), var(--panel-solid));
}
.player-info { min-width: 200px; flex: 1; }
.player-name { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.player-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-dim); font-size: 13px; }
.player-meta b { color: var(--text); font-weight: 600; }

.tier-box {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: none;
}
.tier-emblem {
  --tier-color: hsl(var(--tier-hue), 68%, 56%);
  width: 116px; height: 116px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 25%, hsla(var(--tier-hue), 80%, 60%, 0.32), transparent 70%),
    rgba(10, 15, 24, 0.7);
  border: 1.5px solid hsla(var(--tier-hue), 70%, 55%, 0.55);
  box-shadow: 0 0 26px hsla(var(--tier-hue), 70%, 50%, 0.28), inset 0 0 22px hsla(var(--tier-hue), 70%, 50%, 0.12);
  position: relative;
  flex: none;
}
.tier-label {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--tier-color);
  text-shadow: 0 0 18px hsla(var(--tier-hue), 80%, 60%, 0.55);
  line-height: 1;
}
.tier-stars { position: absolute; bottom: 12px; font-size: 11px; color: var(--tier-color); letter-spacing: 2px; }
.tier-detail { min-width: 150px; }
.tier-name { font-size: 17px; font-weight: 700; margin: 0 0 2px; }
.tier-score { font-size: 13px; color: var(--text-dim); }
.tier-score b { font-size: 22px; color: var(--text); }
.tier-progress { margin: 8px 0 2px; }
.tier-progress-track { height: 5px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.tier-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, hsla(var(--tier-hue), 60%, 45%, 0.6), hsl(var(--tier-hue), 75%, 60%));
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.tier-next { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }

.mini-bars { display: grid; gap: 4px; margin-top: 8px; }
.mini-bar { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-faint); }
.mini-bar-track { flex: 1; height: 5px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.mini-bar-fill { height: 100%; border-radius: 999px; background: hsl(var(--tier-hue), 65%, 55%); }
.mini-bar span:first-child { width: 52px; flex: none; }

/* 四维 */
.dims { display: grid; gap: 13px; }
.dim-row { display: grid; grid-template-columns: 92px 1fr 46px; align-items: center; gap: 12px; }
.dim-name { font-size: 13px; color: var(--text-dim); }
.dim-name small { display: block; color: var(--text-faint); font-size: 11px; }
.dim-track { height: 8px; background: rgba(255, 255, 255, 0.07); border-radius: 999px; overflow: hidden; }
.dim-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, hsla(var(--tier-hue), 60%, 50%, 0.5), hsl(var(--tier-hue), 70%, 58%));
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.dim-value { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* 指标网格 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
.stat {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.stat-label { font-size: 11.5px; color: var(--text-faint); }
.stat-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 11.5px; font-weight: 400; color: var(--text-faint); margin-left: 3px; }
.stat-note { font-size: 11px; color: var(--text-faint); }
.stat-note.up { color: var(--win); }
.stat-note.down { color: var(--lose); }

/* 雷达 */
.radar-wrap { display: grid; place-items: center; }
.radar-canvas { max-width: 100%; }

/* 表格 */
.table-scroll { overflow-x: auto; margin: 0 -6px; }
table.matches { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.matches th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--text-faint);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.matches td { padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); white-space: nowrap; }
table.matches tr:hover td { background: rgba(255, 255, 255, 0.03); }
.num { font-variant-numeric: tabular-nums; }
.win-text { color: var(--win); font-weight: 600; }
.lose-text { color: var(--lose); font-weight: 600; }

.hero-cell { display: flex; align-items: center; gap: 8px; }
.hero-cell img { width: 34px; height: 19px; border-radius: 3px; object-fit: cover; background: #0a0f18; }

.score-pill {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.07);
}
.score-high { background: rgba(78, 201, 122, 0.2); color: #8ee9ac; }
.score-mid { background: rgba(217, 164, 65, 0.18); color: #f0cc82; }
.score-low { background: rgba(224, 87, 95, 0.18); color: #ff9ea3; }

/* 建议 */
.advice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.advice {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--text-faint);
}
.advice.high { border-left-color: var(--lose); }
.advice.mid { border-left-color: var(--accent); }
.advice.good { border-left-color: var(--win); }
.advice.info { border-left-color: var(--accent-2); }
.advice.low { border-left-color: var(--text-faint); }
.advice h3 { margin: 0 0 6px; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.advice p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.7; }
.tag {
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-faint);
  flex: none;
}

.narrative { margin: 0 0 16px; padding: 0; list-style: none; display: grid; gap: 7px; }
.narrative li {
  position: relative;
  padding-left: 16px;
  font-size: 13.5px;
  color: var(--text-dim);
}
.narrative li::before {
  content: "";
  position: absolute;
  left: 2px; top: 9px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
}

/* 英雄推荐 */
.hero-list { display: grid; gap: 10px; }
.hero-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.028);
}
.hero-item-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hero-item-top img { width: 40px; height: 22px; border-radius: 3px; object-fit: cover; background: #0a0f18; flex: none; }
.hero-item-name { font-size: 14px; font-weight: 600; }
.hero-item-pos { font-size: 11px; color: var(--text-faint); }
.hero-item-bars { grid-column: 1 / -1; display: grid; gap: 4px; }
.hero-bar { display: grid; grid-template-columns: 58px 1fr 54px; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-faint); }
.hero-bar-track { height: 5px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.hero-bar-fill { height: 100%; border-radius: 999px; }
.hero-bar-fill.meta { background: linear-gradient(90deg, #3d7f9c, #58c2d8); }
.hero-bar-fill.personal { background: linear-gradient(90deg, #9b7a2c, #e3bc63); }
.hero-bar-fill.personal.bad { background: linear-gradient(90deg, #8a3a40, #d76a71); }
.hero-item-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(217, 164, 65, 0.16);
  color: #f0cc82;
  white-space: nowrap;
}
.hero-note { font-size: 12px; color: var(--text-faint); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 16px; }
.plan-col h3 {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--text-dim);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.plan-col h3 .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.plan-col.meta h3 .dot { background: var(--accent-2); }
.plan-col.good h3 .dot { background: var(--win); }
.plan-col.bad h3 .dot { background: var(--lose); }
.plan-empty { font-size: 12.5px; color: var(--text-faint); }

.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
}
.hero-chip img { width: 30px; height: 17px; border-radius: 3px; object-fit: cover; background: #0a0f18; }
.hero-chip b { font-weight: 600; }
.hero-chip .wr { color: var(--win); font-variant-numeric: tabular-nums; }
.hero-chip .wr.bad { color: var(--lose); }

.detail-toggle {
  background: none;
  border: 0;
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
  margin-top: 12px;
  border-bottom: 1px dashed var(--line-strong);
}
.detail-toggle:hover { color: var(--text-dim); }

.methodology { font-size: 12.5px; color: var(--text-dim); display: grid; gap: 8px; margin: 0; padding-left: 18px; }
.methodology li { padding-left: 2px; }
.methodology b { color: var(--text); }

.warn-note {
  font-size: 12.5px;
  color: #f0cc82;
  background: rgba(217, 164, 65, 0.1);
  border: 1px solid rgba(217, 164, 65, 0.25);
  border-radius: 8px;
  padding: 9px 12px;
  margin: 0 0 14px;
}

/* 页脚 */
.footer {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 48px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 12.5px;
}
.footer p { margin: 0 0 6px; }
.footer-meta { font-size: 11.5px; }

@media (max-width: 640px) {
  .player-card { gap: 16px; }
  .tier-box { width: 100%; }
  .tier-emblem { width: 92px; height: 92px; border-radius: 18px; }
  .tier-label { font-size: 27px; }
  .dim-row { grid-template-columns: 78px 1fr 42px; }
  .search { flex-direction: column; }
  .search button { width: 100%; }
}
