:root {
  --bg: #0b0f16;
  --bg-2: #111826;
  --panel: rgba(23, 31, 46, 0.86);
  --panel-2: #18212f;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e8eef8;
  --muted: #93a2ba;
  --accent: #ff4d4d;
  --accent-2: #ffcb05;
  --ok: #4ade80;
  --warn: #ffb03a;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(255, 77, 77, 0.16), transparent 60%),
    radial-gradient(900px 480px at 92% 0%, rgba(255, 203, 5, 0.12), transparent 58%),
    linear-gradient(180deg, #0b0f16 0%, #0b0f16 40%, #0a0d13 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: 0.2px; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}

/* ── 顶栏 ─────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(9, 13, 20, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.ball {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent) 0 47%, #11151c 47% 53%, #f4f7fb 53% 100%);
  box-shadow: 0 0 0 2px #0b0f16, 0 0 18px rgba(255, 77, 77, 0.45);
}
.ball i {
  position: absolute;
  inset: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: #f4f7fb;
  border: 2px solid #11151c;
}

.brand-text h1 { font-size: 19px; line-height: 1.25; }
.brand-text p { font-size: 12px; color: var(--muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 7px 15px;
  border-radius: 999px;
  transition: all 0.16s ease;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.is-active {
  color: #10141b;
  background: linear-gradient(180deg, var(--accent-2), #f2b705);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(255, 203, 5, 0.25);
}

/* ── 布局 ─────────────────────────────────────── */
main { padding: clamp(16px, 3vw, 32px) clamp(16px, 4vw, 40px) 60px; max-width: 1180px; margin: 0 auto; }

.view { display: none; animation: fade 0.22s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head { margin-bottom: 18px; }
.section-head h2 { font-size: 21px; margin-bottom: 4px; }
.section-head p { color: var(--muted); font-size: 13.5px; }

/* ── 问答 ─────────────────────────────────────── */
.ask-panel { margin-bottom: 20px; }

.ask-form { display: flex; gap: 10px; }

.ask-form input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.ask-form input::placeholder { color: #6d7c92; }
.ask-form input:focus { border-color: rgba(255, 203, 5, 0.6); box-shadow: 0 0 0 4px rgba(255, 203, 5, 0.12); }

button.primary {
  border: none;
  color: #10141b;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--accent-2), #eeb901);
  box-shadow: 0 8px 20px rgba(255, 203, 5, 0.22);
  transition: transform 0.12s, filter 0.12s;
}
button.primary:hover { filter: brightness(1.06); }
button.primary:active { transform: translateY(1px); }

button.ghost {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  padding: 12px 16px;
  border-radius: var(--radius);
}
button.ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }

.sample-row, .followups, .ans-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sample-row { margin-top: 12px; }

.chip-btn {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  transition: all 0.15s;
}
.chip-btn:hover { color: var(--text); border-color: rgba(255, 203, 5, 0.45); background: rgba(255, 203, 5, 0.08); }
.chip-btn.is-active {
  color: #10141b;
  font-weight: 700;
  background: var(--tc, var(--accent-2));
  border-color: transparent;
}

/* 回答卡片 */
.answer-wrap { min-height: 120px; }

.answer-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(18px, 2.4vw, 26px);
  box-shadow: var(--shadow);
}

.answer-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.answer-title { font-size: 22px; line-height: 1.3; }
.answer-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

.conf {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: help;
}
.conf-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.conf-high { color: #9ef0be; border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.1); }
.conf-mid { color: #ffd37a; border-color: rgba(255, 176, 58, 0.35); background: rgba(255, 176, 58, 0.1); }
.conf-low { color: #ff9c9c; border-color: rgba(255, 77, 77, 0.35); background: rgba(255, 77, 77, 0.1); }

.ans-p { margin: 10px 0; }
.ans-note {
  margin: 10px 0;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #b9c6d9;
  background: rgba(255, 255, 255, 0.035);
  border-left: 3px solid rgba(255, 203, 5, 0.55);
  border-radius: 0 10px 10px 0;
}

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 16px; margin: 14px 0; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }

.ans-list { margin: 10px 0; padding-left: 20px; color: #cfdaeb; }
.ans-list li { margin: 4px 0; }

.table-wrap {
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ans-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ans-table th, .ans-table td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ans-table th {
  font-weight: 600;
  color: #c3d0e2;
  background: rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
}
.ans-table tr:last-child td { border-bottom: none; }
.ans-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

/* 种族值条 */
.stats-block { margin: 14px 0 4px; padding: 14px 16px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 12px; }
.stats-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.stats-head strong { color: var(--text); }

.stat-bars { display: grid; gap: 7px; }
.stat-row { display: grid; grid-template-columns: 42px 1fr 38px; align-items: center; gap: 10px; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.stat-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 55%, #ffffff)); }
.stat-value { font-family: var(--mono); font-size: 12.5px; text-align: right; color: #cfdaeb; }

/* 属性徽章 */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tbadge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #0d1117;
  background: var(--tc, #888);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.ans-chips { margin: 12px 0; }
.chip-wrap { display: inline-flex; }

/* 引用 */
.sources-block { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.sources-block h3 { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.sources { margin: 0; padding-left: 20px; }
.sources li { margin-bottom: 10px; }
.source-link {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.source-tag {
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}
.source-snippet { color: #96a5bb; font-size: 12.5px; margin-top: 2px; }

.answer-foot { margin-top: 14px; font-size: 12px; color: #6f7e94; }

.followups { margin-top: 18px; align-items: center; }
.followups-label { font-size: 13px; color: var(--muted); }

/* ── 图鉴 ─────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.toolbar input, .toolbar select {
  padding: 10px 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  font-size: 14px;
}
.toolbar input { flex: 1 1 280px; }
.toolbar input:focus, .toolbar select:focus { border-color: rgba(255, 203, 5, 0.5); }
.toolbar select { cursor: pointer; }

.type-filter { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.type-filter .chip-btn { border-color: color-mix(in srgb, var(--tc, #888) 55%, transparent); }
.type-filter .chip-btn:not(.is-active):hover { background: color-mix(in srgb, var(--tc, #888) 22%, transparent); }

.result-count { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }

.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }

.dex-card {
  text-align: left;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(31, 41, 58, 0.92), rgba(20, 27, 39, 0.92));
  color: var(--text);
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.dex-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 203, 5, 0.42);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
}
.dex-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dex-no { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.dex-bst { font-size: 11.5px; color: var(--accent-2); font-weight: 700; }
.dex-name { font-size: 17px; margin-bottom: 1px; }
.dex-en { font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.dex-role { margin-top: 9px; font-size: 12px; color: #9dabc0; line-height: 1.5; }

/* ── 相克表 ───────────────────────────────────── */
.chart-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 74vh; }
.chart-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.chart-table th, .chart-table td {
  padding: 6px 8px;
  text-align: center;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.chart-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #131b27;
  color: #dfe8f5;
  font-weight: 600;
}
.chart-table .corner { left: 0; z-index: 3; color: var(--muted); font-weight: 500; }
.chart-table .chart-th { border-bottom: 2px solid var(--tc); }
.chart-table .chart-rowhead {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #131b27;
  font-weight: 600;
  border-right: 2px solid var(--tc);
}
.cell { cursor: pointer; font-family: var(--mono); color: #c9d5e6; transition: background 0.12s, color 0.12s; }
.cell.m1 { color: #7d8ca2; }
.cell.m2 { background: rgba(255, 77, 77, 0.22); color: #ffd7d7; font-weight: 700; }
.cell.m05 { background: rgba(74, 222, 128, 0.16); color: #c7f6d8; }
.cell.m0 { background: rgba(10, 12, 18, 0.9); color: #55637a; }
.cell:hover { outline: 2px solid var(--accent-2); outline-offset: -2px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 4px; font-size: 12.5px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 7px; }
.lg::before { content: ""; width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.lg-2::before { background: rgba(255, 77, 77, 0.55); }
.lg-1::before { background: rgba(255, 255, 255, 0.12); }
.lg-05::before { background: rgba(74, 222, 128, 0.45); }
.lg-0::before { background: #0a0c12; border: 1px solid var(--line-strong); }

.chart-detail { margin-top: 14px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-height: 20px; }

/* ── 队伍 ─────────────────────────────────────── */
.team-add { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.team-add input {
  flex: 1 1 260px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
}
.team-add input:focus { border-color: rgba(255, 203, 5, 0.5); }

.team-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 20px; }
.slot {
  position: relative;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(31, 41, 58, 0.9), rgba(19, 26, 37, 0.9));
  min-height: 96px;
}
.slot.empty { display: grid; place-items: center; color: #5c6b81; border-style: dashed; background: transparent; font-size: 13px; }
.slot-name { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin-bottom: 8px; }
.slot-name strong { font-size: 15.5px; }
.slot-remove {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  border-radius: 7px;
  padding: 2px 8px;
}
.slot-remove:hover { color: #ff9c9c; border-color: rgba(255, 77, 77, 0.4); }

.team-report h3 { font-size: 16px; margin-bottom: 10px; }

/* ── 关于 ─────────────────────────────────────── */
.about { max-width: 820px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 3vw, 32px); }
.about h2 { font-size: 22px; margin-bottom: 10px; }
.about h3 { font-size: 15px; margin: 20px 0 8px; color: var(--accent-2); }
.about p { color: #c3d0e2; }
.about ul { margin: 8px 0; padding-left: 20px; color: #b6c3d6; }
.about li { margin: 5px 0; }

/* ── 弹窗 ─────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 7, 12, 0.72); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #131b27;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  animation: pop 0.18s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: none; } }

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }

.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 6px; }
.detail-title { font-size: 24px; margin: 2px 0 6px; }
.detail-sub { color: var(--muted); font-size: 13px; }
.detail-text { color: #c8d4e6; margin: 12px 0; }
.detail-src { color: #6f7e94; font-size: 12px; margin-top: 14px; }
.detail-bst { text-align: right; flex: 0 0 auto; }
.detail-bst strong { display: block; font-size: 26px; color: var(--accent-2); font-family: var(--mono); }
.detail-bst span { font-size: 11.5px; color: var(--muted); }

/* ── 页脚 ─────────────────────────────────────── */
.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 40px) 30px;
  color: #5c6b81;
  font-size: 12px;
  border-top: 1px solid var(--line);
  max-width: 1180px;
  margin: 0 auto;
}

/* ── 响应式 ───────────────────────────────────── */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .brand-text h1 { font-size: 16px; }
  .brand-text p { display: none; }
  .tab { padding: 6px 11px; font-size: 13px; }
  .ask-form { flex-wrap: wrap; }
  .ask-form button.primary { width: 100%; }
  .answer-title { font-size: 19px; }
  .kv { grid-template-columns: 92px 1fr; }
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .stat-row { grid-template-columns: 38px 1fr 34px; }
  .footer { padding-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── 分享链接 / 轻提示 ───────────────────────── */
.tab.share {
  border-color: rgba(255, 203, 5, 0.32);
  color: #ffd76a;
}
.tab.share:hover {
  color: #ffe9a6;
  background: rgba(255, 203, 5, 0.12);
  border-color: rgba(255, 203, 5, 0.5);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(92vw, 620px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #ffe9a6;
  background: rgba(18, 25, 37, 0.97);
  border: 1px solid rgba(255, 203, 5, 0.42);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  word-break: break-all;
  animation: pop 0.16s ease;
}
.toast[hidden] { display: none; }

@media (max-width: 720px) {
  .toast { bottom: 16px; font-size: 12.5px; }
}
