:root {
  --bg: #0a0e1a;
  --bg-soft: #141c30;
  --card: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.08);
  --gold: #efc06b;
  --gold-dim: rgba(239, 192, 107, 0.16);
  --text: #eef2f8;
  --sub: #8b95a8;
  --dim: #5d6678;
  --blue: #6f9ee8;
  --teal: #5fb8a0;
}

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

/* 关键：hidden 属性必须压过类选择器里的 display，
   否则 .d-loading/.d-error 上的 display:flex 会让 hidden 失效 */
[hidden] {
  display: none !important;
}

html {
  background: #060911;
}

body {
  background: #060911;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

@media (min-width: 560px) {
  body { padding: 24px 0; }
  .app {
    min-height: calc(100vh - 48px);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }
}

.view {
  display: none;
  padding-bottom: 32px;
}

.view.active {
  display: block;
  animation: fade 0.22s ease both;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 头部 ---------- */
.head {
  padding: 30px 20px 20px;
  background:
    radial-gradient(120% 90% at 8% 0%, rgba(239, 192, 107, 0.16) 0%, rgba(10, 14, 26, 0) 62%),
    linear-gradient(180deg, #151d33 0%, #0a0e1a 100%);
}

.eyebrow {
  color: rgba(239, 192, 107, 0.85);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
}

.head h1 {
  margin-top: 10px;
  color: var(--gold);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
}

.sub {
  margin-top: 6px;
  color: var(--sub);
  font-size: 13px;
}

/* ---------- 区服 ---------- */
.zones {
  display: flex;
  gap: 6px;
  padding: 0 20px;
}

.zone {
  flex: 1;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sub);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}

.zone:hover { background: rgba(255, 255, 255, 0.07); }

.zone.on {
  border-color: rgba(239, 192, 107, 0.6);
  background: linear-gradient(140deg, rgba(239, 192, 107, 0.26) 0%, rgba(239, 192, 107, 0.08) 100%);
  color: var(--gold);
  font-weight: 600;
}

.zones-sm .zone {
  height: 36px;
  font-size: 12px;
}

/* ---------- 搜索 ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin: 14px 20px 0;
  padding: 0 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 0.18s;
}

.search:focus-within { border-color: rgba(239, 192, 107, 0.4); }

.ic-search {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--dim);
}

.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { display: none; }

.clear {
  border: none;
  background: none;
  color: var(--dim);
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

/* ---------- 职业 ---------- */
.types {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0;
}

.type {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: #7c8698;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.type:hover { color: var(--text); }

.type.on {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 600;
}

/* ---------- 计数 ---------- */
.count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 4px;
  color: var(--dim);
  font-size: 11.5px;
}

.zone-label { color: var(--gold); opacity: 0.85; }

/* ---------- 英雄网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px 0;
  padding: 4px 12px 0;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.card:hover { background: rgba(255, 255, 255, 0.055); }
.card:active { transform: scale(0.96); }

.card img {
  width: 66px;
  height: 66px;
  border-radius: 12px;
  background: #1a2338;
  object-fit: cover;
  display: block;
}

.card .nm {
  margin-top: 6px;
  color: #e2e8f2;
  font-size: 12px;
  line-height: 1.2;
  max-width: 74px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card .tp {
  margin-top: 2px;
  color: #6b7488;
  font-size: 10px;
  line-height: 1.2;
}

/* ---------- 空态 ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 70px 20px;
  color: var(--sub);
  font-size: 14px;
}

.empty span { color: var(--dim); font-size: 12px; }

/* ---------- 页脚 ---------- */
.foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-top: 26px;
  padding: 0 30px;
  text-align: center;
}

.foot p {
  color: #3f4657;
  font-size: 10.5px;
  line-height: 1.7;
}

/* ---------- 详情 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 6px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #0a0e1a 70%, rgba(10, 14, 26, 0));
  z-index: 5;
}

.back {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}

.back:hover { background: rgba(255, 255, 255, 0.1); }

.topbar-title {
  color: var(--sub);
  font-size: 13px;
}

.d-loading,
.d-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 100px 30px 60px;
  color: var(--sub);
  font-size: 13px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.err-badge {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(224, 112, 90, 0.6);
  color: #e0705a;
  font-size: 20px;
  font-weight: 700;
}

.retry {
  margin-top: 6px;
  height: 38px;
  padding: 0 28px;
  border-radius: 19px;
  border: 1px solid rgba(239, 192, 107, 0.5);
  background: rgba(239, 192, 107, 0.16);
  color: var(--gold);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.d-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 18px;
}

.d-avatar {
  width: 74px;
  height: 74px;
  border-radius: 14px;
  background: #1a2338;
  border: 1px solid rgba(239, 192, 107, 0.25);
  object-fit: cover;
  flex-shrink: 0;
}

.d-meta { min-width: 0; }

.d-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.d-name-row h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.d-type {
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(239, 192, 107, 0.14);
  color: var(--gold);
  font-size: 10.5px;
}

.d-title {
  margin-top: 5px;
  color: #7c8698;
  font-size: 12.5px;
}

/* 三档 */
.boards {
  display: flex;
  gap: 7px;
  padding: 14px 20px 0;
}

.board {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  overflow: hidden;
}

.board::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 2px;
  border-radius: 0 0 2px 2px;
}

.board.p::before { background: var(--gold); }
.board.c::before { background: var(--blue); }
.board.a::before { background: var(--teal); }

.board .lb {
  color: var(--sub);
  font-size: 11.5px;
}

.board .pv {
  margin-top: 5px;
  color: var(--gold);
  font-size: 21px;
  font-weight: 700;
  font-family: 'DIN Alternate', 'Helvetica Neue', sans-serif;
  line-height: 1.1;
}

.board .ar {
  margin-top: 4px;
  color: var(--dim);
  font-size: 10px;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 国标 */
.national {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 11px 20px 0;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.national span { color: var(--sub); font-size: 12.5px; }
.national strong {
  font-size: 17px;
  font-family: 'DIN Alternate', 'Helvetica Neue', sans-serif;
}

/* 对比表 */
.cmp {
  margin: 16px 20px 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.cmp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 10px;
}

.cmp-head h3 { font-size: 14.5px; font-weight: 600; }
.cmp-head span { color: var(--dim); font-size: 10px; }

.cmp-table { padding: 0 8px 8px; }

.row {
  display: grid;
  grid-template-columns: 32% 22.6% 22.6% 22.6%;
  align-items: center;
  height: 44px;
  padding: 0 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.row:not(.row-head):hover { background: rgba(255, 255, 255, 0.05); }
.row.on { background: rgba(239, 192, 107, 0.08); }

.row-head {
  height: 28px;
  cursor: default;
}

.row-head > * {
  color: #596273;
  font-size: 10.5px;
  font-weight: 400;
}

.zc {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #c3cbd9;
  font-size: 12.5px;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #39435a;
  flex-shrink: 0;
}

.row.on .dot { background: var(--gold); }

.vl {
  text-align: right;
  color: #d7dee9;
  font-size: 12.5px;
  font-family: 'DIN Alternate', 'Helvetica Neue', sans-serif;
}

.vl.low { color: var(--gold); font-weight: 700; }
