:root {
  color-scheme: light;
  --ink: #30332f;
  --muted: #686d64;
  --faint: #92988d;
  --primary: #d7b35b;
  --accent: #84621e;
  --brand-gold: #b58b40;
  --brand-cutout: #fff9ea;
  --accent-soft: #f7f0dd;
  --accent-line: #dfcea0;
  --paper: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #f8f9f5;
  --line: #e3e5dd;
  --row-line: #eef0e9;
  --row-hover: #fbf5e6;
  --bar-track: #eeeadf;
  --bar-fill: #c3a15a;
  --danger: #a45140;
  --selection: #efdfad;
  --download-start: #faf3df;
  --download-end: #f0e1b8;
  --download-hover: #ecdaab;
  --export-tint: #faf4e5;
  --focus-ring: rgba(186, 151, 73, .12);
  --board-shadow: 0 12px 36px rgba(28, 36, 30, .045);
  --menu-shadow: 0 8px 28px rgba(28, 36, 30, .12);
}
:root[data-theme=dark] {
  color-scheme: dark;
  --ink: #e9e9e9;
  --muted: #ababab;
  --faint: #888888;
  --primary: #d7b35b;
  --accent: #e4bf70;
  --brand-gold: #d7b35b;
  --brand-cutout: #29251c;
  --accent-soft: #303030;
  --accent-line: #665635;
  --paper: #191919;
  --surface: #232323;
  --surface-soft: #292929;
  --line: #3b3b3b;
  --row-line: #303030;
  --row-hover: #333333;
  --bar-track: #3b3b3b;
  --bar-fill: #c9a65d;
  --danger: #ed9a87;
  --selection: #63512b;
  --download-start: #3d3523;
  --download-end: #302c21;
  --download-hover: #494027;
  --export-tint: #292929;
  --focus-ring: rgba(228, 191, 112, .16);
  --board-shadow: 0 12px 36px rgba(0, 0, 0, .16);
  --menu-shadow: 0 8px 28px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
button, a, input, select { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); }
::selection { background: var(--selection); color: var(--ink); }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; text-decoration: none; }
header { height: 70px; padding: 0 max(5vw, 24px); display: flex; align-items: center; gap: 60px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 750; white-space: nowrap; }
.brand-logo { width: 35px; height: 35px; flex: 0 0 auto; color: var(--brand-gold); }
.theme-picker { position: relative; order: 2; margin-left: auto; flex: 0 0 auto; z-index: 2; }
.theme-toggle { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); }
.theme-toggle:hover, .theme-toggle[aria-expanded=true] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.theme-icon { display: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme-preference=system] .theme-icon-system,
:root[data-theme-preference=light] .theme-icon-light,
:root[data-theme-preference=dark] .theme-icon-dark { display: block; }
.theme-menu { position: absolute; top: calc(100% + 10px); right: 0; width: 148px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--menu-shadow); }
.theme-menu button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 8px 10px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; }
.theme-menu button:hover, .theme-menu button:focus-visible { background: var(--surface-soft); color: var(--ink); outline-offset: -2px; }
.theme-menu button[aria-checked=true] { background: var(--accent-soft); color: var(--accent); }
.theme-menu button span { visibility: hidden; }
.theme-menu button[aria-checked=true] span { visibility: visible; }
nav { display: flex; order: 1; height: 100%; gap: 36px; }
nav button { border: 0; background: none; color: var(--muted); padding: 0 8px; position: relative; font-weight: 600; }
nav button[aria-pressed=true] { color: var(--accent); }
nav button[aria-pressed=true]::after { content: ""; position: absolute; height: 3px; background: var(--primary); left: 8px; right: 8px; bottom: 0; }
nav button:hover, .view-tabs button:hover { color: var(--accent); }
main { max-width: 1000px; margin: auto; padding: 0 40px; }
.overview { display: flex; justify-content: space-between; gap: 10px; padding: 22px 0 14px; color: var(--muted); font-size: 12px; }
.overview b { color: var(--ink); font-weight: 600; }
.board { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--board-shadow); }
.board-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.view-tabs { display: flex; gap: 28px; }
.view-tabs button { border: 0; background: transparent; padding: 18px 0 15px; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 650; font-size: 16px; }
.view-tabs button[aria-pressed=true] { border-bottom-color: var(--primary); color: var(--accent); }
.download { border: 1px solid var(--accent-line); background: linear-gradient(145deg, var(--download-start), var(--download-end)); color: var(--accent); border-radius: 6px; padding: 7px 12px; font-size: 12px; white-space: nowrap; }
.download:hover:enabled { background: var(--download-hover); border-color: var(--bar-fill); }
#export-status { color: var(--danger); margin: 12px 24px 0; font-size: 12px; }
.filters { display: flex; gap: 14px; padding: 18px 24px; }
.filters label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted); }
.filters input, .filters select { height: 37px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; background: var(--surface-soft); color: var(--ink); font-size: 12px; min-width: 145px; }
.filters input::placeholder { color: var(--faint); opacity: 1; }
.filters input:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); outline: none; }
.filters select:focus { background: var(--surface); border-color: var(--accent); outline: none; }
.filters input[type=number] { width: 145px; }
.filters .search { margin-left: auto; min-width: 235px; }
.table-meta { padding: 11px 24px; display: flex; justify-content: space-between; gap: 10px; background: var(--surface-soft); border-top: 1px solid var(--line); font-size: 12px; }
.table-meta span:first-child { font-weight: 600; }
.table-meta span:last-child { color: var(--muted); }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; white-space: nowrap; text-align: left; font-size: 12px; }
th { font-size: 11px; color: var(--muted); font-weight: 500; padding: 12px 18px; border-bottom: 1px solid var(--line); }
td { padding: 11px 18px; border-bottom: 1px solid var(--row-line); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { padding-left: 24px; width: 70px; }
th:last-child, td:last-child { padding-right: 24px; }
th:nth-child(2) { width: 28%; }
/* 其余数值列右对齐并固定列宽，武将/组合列自适应。 */
th:nth-child(n+3), td:nth-child(n+3) { text-align: right; }
th:nth-child(3), td:nth-child(3) { width: 132px; text-align: left; }
th:nth-child(4), td:nth-child(4) { width: 96px; }
th:nth-child(5), td:nth-child(5) { width: 110px; }
th:nth-child(6), td:nth-child(6) { width: 150px; }
tbody tr:nth-child(even) { background: var(--surface-soft); }
tbody tr:hover { background: var(--row-hover); }
.rank-number { color: var(--muted); font-size: 15px; font-weight: 700; }
.rank-number.top { color: var(--accent); }
.general-cell { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; flex-shrink: 0; border-radius: 6px; background: var(--accent-soft); object-fit: cover; object-position: center 20%; display: grid; place-items: center; font-size: 19px; color: var(--accent); }
.general-name { font-weight: 650; font-size: 14px; }
.score { font-size: 17px; font-weight: 650; color: var(--accent); }
.score.neg { color: var(--danger); }
.score-bar { width: 88px; height: 3px; border-radius: 5px; background: var(--bar-track); margin: 5px 0 0; overflow: hidden; }
.score-bar i { height: 100%; display: block; background: var(--bar-fill); }
.pair-sep { color: var(--faint); font-size: 19px; font-weight: 500; }
.pair-side { display: flex; align-items: center; gap: 12px; min-width: 0; }
.partner-board .general-cell { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.partner-board th:nth-child(2) { width: 40%; }
.score small { font-size: 10px; font-weight: 400; }
#table-title { scroll-margin-top: 12px; }
.pair-side .general-name { overflow-wrap: anywhere; white-space: normal; }
.filters label[hidden] { display: none; }
.interval { color: var(--muted); }
.status { text-align: center; color: var(--muted); padding: 20px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 25px; padding: 16px; color: var(--muted); font-size: 11px; }
.pagination button { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 5px 12px; color: var(--ink); }
.pagination button:hover:enabled { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.method { margin: 22px 0 30px; color: var(--muted); font-size: 12px; }
.method p { max-width: 900px; line-height: 1.8; }
.method ol { max-width: 960px; margin: 12px 0; padding-left: 20px; line-height: 1.8; }
.method li + li { margin-top: 6px; }
.method b { color: var(--ink); }
summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; list-style: none; font-size: 13px; }
summary::-webkit-details-marker { display: none; }
.method-summary::before { content: "▸"; display: inline-block; color: var(--muted); font-size: 13px; margin-right: 8px; transition: transform .15s ease; }
details[open] .method-summary::before { transform: rotate(90deg); }
@media (max-width: 1000px) {
  .pair-side { flex-direction: column; gap: 4px; }
  .pair-side .general-name { text-align: center; }
}
@media (max-width: 850px) {
  .partner-board th:nth-child(n+5), .partner-board td:nth-child(n+5) { display: none; }
  header { gap: 25px; padding: 0 20px; }
  .theme-picker { order: 1; margin-left: 0; }
  .theme-menu { left: 0; right: auto; }
  nav { order: 2; gap: 16px; margin-left: auto; }
  main { padding: 0 20px; }
  .filters { flex-wrap: wrap; }
  .filters .search { margin-left: 0; min-width: 145px; flex: 1; }
}
@media (max-width: 560px) {
  header { height: 60px; gap: 15px; }
  .brand { font-size: 17px; }
  .brand-logo { width: 29px; height: 29px; }
  .brand span { display: none; }
  nav { gap: 9px; }
  nav button { padding: 0 4px; font-size: 12px; }
  main { padding: 0 12px; }
  .overview { flex-wrap: wrap; padding: 14px 2px 10px; font-size: 10px; gap: 3px 10px; }
  .board-heading { padding: 0 12px; }
  .view-tabs { gap: 16px; }
  .view-tabs button { font-size: 14px; padding: 15px 0 12px; }
  .download { padding: 6px 8px; font-size: 11px; }
  .filters { padding: 14px 12px; gap: 10px; }
  .filters label { width: calc(50% - 5px); }
  .filters input, .filters select, .filters input[type=number] { width: 100%; min-width: 0; }
  .filters .search { min-width: 0; }
  .table-meta { padding: 10px 12px; font-size: 11px; }
  th, td { padding: 10px 7px; }
  th:first-child, td:first-child { padding-left: 12px; width: 36px; }
  th:nth-child(4), td:nth-child(4) { padding-right: 12px; }
  th:nth-child(2) { width: auto; }
  th:nth-child(3), td:nth-child(3), th:nth-child(4), td:nth-child(4) { width: auto; }
  th:nth-child(2) { width: auto; }
  th:nth-child(n+5), td:nth-child(n+5) { display: none; }
  .avatar { width: 32px; height: 32px; }
  .general-cell { gap: 7px; }
  .general-name { font-size: 12px; white-space: normal; }
  .partner-board table { table-layout: fixed; }
  .partner-board th:first-child { width: 32px; }
  .partner-board th:nth-child(2) { width: auto; }
  .partner-board th:nth-child(3) { width: 73px; }
  .partner-board th:nth-child(4) { width: 49px; }
  .partner-board .general-cell { gap: 3px; }
  .partner-board .score small { display: block; }
  .pair-sep { font-size: 15px; }
  .score { font-size: 14px; }
  .score-bar { width: 54px; }
  .rank-number { font-size: 12px; }
  #export-status { margin: 10px 12px 0; }
}

.site-home-link { color: var(--muted); font-size: 13px; opacity: .75; font-weight: 400; }
.site-home-link:hover { color: var(--accent); opacity: 1; }

@media (max-width: 360px) {
  .board-heading { flex-wrap: wrap; gap: 0; padding-bottom: 10px; }
  .view-tabs { width: 100%; justify-content: space-between; }
  .download { margin-left: auto; }
}
