:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #616c7e;
  --line: #e3e7ee;
  --line-strong: #cfd6e2;
  --brand: #1d4ed8;
  --brand-soft: #eef2ff;
  --gold: #a16207;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #111a2c;
  --ink: #e7eefb;
  --ink-soft: #b3c0d6;
  --muted: #8593ab;
  --line: #1e2a42;
  --line-strong: #2b3a56;
  --brand: #6ea8ff;
  --brand-soft: #16213a;
  --gold: #e0b25c;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.2) blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  letter-spacing: .2px;
}

.brand svg { width: 20px; height: 20px; fill: var(--brand); }
.brand em {
  font: 500 11px/1 var(--mono);
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding-left: 8px;
  border-left: 1px solid var(--line-strong);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i-moon { display: none; }
html[data-theme="dark"] .i-sun { display: none; }
html[data-theme="dark"] .i-moon { display: block; }

/* ---------- 布局 ---------- */
main {
  width: min(800px, 100%);
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.intro h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 4.6vw, 30px);
  line-height: 1.25;
  letter-spacing: -.02em;
  font-weight: 680;
}

.intro p {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ---------- 查询面板 ---------- */
.panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field { display: grid; gap: 8px; }

label, .label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--muted);
  text-transform: uppercase;
}

input[type="text"],
input:not([type]) {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  transition: border-color .15s ease, background .15s ease;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
}
input::placeholder { color: var(--muted); }

.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.seg button {
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.seg button:hover { border-color: var(--ink-soft); color: var(--ink); }
.seg button.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.submit {
  height: 46px;
  padding: 0 26px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-width: 168px;
  transition: filter .15s ease, transform .1s ease;
}
.submit:hover { filter: brightness(1.06); }
.submit:active { transform: scale(.995); }
.submit[disabled] { opacity: .6; cursor: progress; }

/* ---------- 结果 ---------- */
.out { margin-top: 20px; min-height: 1px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.card-head img {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--bg);
}

.card-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.01em;
}

.card-head p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.ladder { display: grid; }

.ladder-row {
  cursor: pointer;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.ladder-row:last-child { border-bottom: 0; }

.ladder-row .lv {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .08em;
}

.ladder-row .area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--ink-soft);
  font-size: 14px;
}
.ladder-row .area .an {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ladder-row .area .ap {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ladder-row .pw {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.ladder-row:hover { background: color-mix(in srgb, var(--line) 45%, transparent); }
.ladder-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.ladder-row.low {
  background: var(--brand-soft);
}
.ladder-row.low:hover { background: color-mix(in srgb, var(--brand) 12%, var(--brand-soft)); }
.ladder-row.low::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--brand);
}
.ladder-row.low .pw { color: var(--brand); }

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid currentColor;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  vertical-align: 2px;
  color: var(--brand);
}

.card-foot {
  padding: 12px 18px 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
.card-foot b { color: var(--ink); font-weight: 600; }

/* 骨架 / 错误 */
.skeleton { display: grid; gap: 10px; }
.sk {
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 37%, var(--line) 63%);
  background-size: 400% 100%;
  animation: sk 1.2s ease-in-out infinite;
}
.sk.w40 { width: 40%; }
.sk.w70 { width: 70%; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.err {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 14px;
}
.err strong { display: block; margin-bottom: 4px; color: var(--ink); }
.err button {
  margin-top: 12px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

/* ---------- 说明 ---------- */
.notes { margin-top: 34px; }
.notes h2 {
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.notes ol {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 14px;
}
.notes li { margin-bottom: 6px; }
.disclaimer {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: min(800px, 100%);
  margin: 0 auto;
  padding: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  main { padding-top: 20px; }
  .seg { grid-template-columns: repeat(2, 1fr); }
  .ladder-row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; padding: 12px 15px; }
  .ladder-row .pw { font-size: 18px; }
  .card-head { padding: 14px 15px; }
  .card-head img { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* 快捷英雄 */
.quick {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.quick button {
  height: 30px;
  padding: 0 10px;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.quick button:hover { border-color: var(--line-strong); color: var(--ink); }

@media (max-width: 560px) {
  .actions { gap: 12px; }
  .submit { width: 100%; }
  .quick { width: 100%; }
}


/* 深色下主按钮用浅蓝底 + 深字，保证对比度（白字在 #6ea8ff 上只有 2.1:1） */
html[data-theme="dark"] .submit { color: #08111f; font-weight: 650; }
html[data-theme="dark"] .seg button.on { background: #e7eefb; border-color: #e7eefb; color: #0b1020; }


/* ---------- 战区详情弹层 ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(9, 14, 26, .46); }

.sheet-panel {
  position: relative;
  margin: auto;
  width: min(440px, calc(100% - 32px));
  padding: 24px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(9, 14, 26, .18);
}

.sheet-panel h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.01em;
}
.sheet-sub {
  margin: 4px 0 18px;
  font-size: 12.5px;
  color: var(--muted);
}

.sheet-list {
  margin: 0 0 20px;
  display: grid;
  gap: 12px;
}
.sheet-list > div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}
.sheet-list dt {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
}
.sheet-list dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.5;
}
.sheet-list dd.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
}

.sheet-actions { display: flex; gap: 10px; }
.btn-ghost {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.btn-ghost:hover { border-color: var(--ink-soft); background: var(--bg); }

.sheet-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.sheet-close:hover { background: var(--bg); color: var(--ink); }
.sheet-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

@media (max-width: 560px) {
  .sheet { align-items: flex-end; }
  .sheet-panel {
    width: 100%;
    margin: 0;
    border-radius: 14px 14px 0 0;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
    animation: rise .18s ease-out;
  }
}
@keyframes rise {
  from { transform: translateY(14px); opacity: .7; }
  to   { transform: none; opacity: 1; }
}
