:root {
    color-scheme: light;
    --width: 1168px;
    --paper: #fffdf7;
    --panel: #f5efe3;
    --ink: #292720;
    --muted: #6b6356;
    --line: #ded4c2;
    --strong: #b8a88b;
    --accent: #75532a;
    --selected: #f0e6d3;
    --padding: 42px;
    --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
    --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
    --number: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #211b1c; color: var(--ink); font: 14px/1.6 var(--sans); }
a { color: inherit; text-decoration: none; }
a:hover, button:hover { color: var(--accent); }
button, input, select { color: inherit; font: inherit; }
button, select { cursor: pointer; }
h1, h2, h3, p, dl, dd { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

body::before, body::after {
    position: fixed;
    inset-block: 0;
    width: max(calc((100% - var(--width)) / 2 + 18px), 182px);
    background-size: auto max(100vh, 760px);
    background-repeat: no-repeat;
    mask-image: linear-gradient(#000 78%, transparent);
    content: "";
    pointer-events: none;
}
body::before { left: 0; background-image: url("cover-left.webp"); background-position: 48% 0; }
body::after { right: 0; background-image: url("cover-right.webp"); background-position: 51% 0; }
.site {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(calc(100% - 76px), var(--width));
    min-height: 100vh;
    margin-inline: auto;
    border-inline: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 0 0 60px #0805077a;
}
.site-header {
    display: flex;
    justify-content: space-between;
    min-height: 76px;
    gap: 22px;
    padding-inline: var(--padding);
    border-bottom: 1px solid var(--line);
}
.wordmark {
    align-self: center;
    font: 700 25px/1 var(--serif);
    letter-spacing: .12em;
    white-space: nowrap;
}
.site-header nav { display: flex; gap: clamp(20px, 3vw, 38px); }
.site-header nav > * { display: inline-flex; align-items: center; white-space: nowrap; }
.site-header nav [aria-current] {
    box-shadow: inset 0 -2px var(--accent);
    color: var(--accent);
    font-weight: 700;
}
.site-header nav [aria-disabled] { color: var(--muted); opacity: .65; }
main { padding: 40px var(--padding) 55px; }
.page-heading {
    position: relative;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--strong);
}
.eyebrow { color: var(--accent); font-weight: 700; letter-spacing: .12em; }
h1 { margin-top: 7px; font: 700 54px/1.14 var(--serif); letter-spacing: .09em; }
.heading-meta {
    position: absolute;
    right: 0;
    bottom: 22px;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.board-layout { display: grid; grid-template-columns: minmax(0, 1fr) 298px; gap: 32px; }
.board { min-width: 0; }
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 19px 0 16px;
}
.filters label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.filters select, .filters input {
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
    font-size: 13px;
}
.filters input { width: min(175px, 43vw); }
.leaderboard { width: 100%; border-spacing: 0; text-align: left; font-variant-numeric: tabular-nums; }
.leaderboard th, .leaderboard td { padding: 0 14px; }
.leaderboard th {
    height: 38px;
    border-block: 1px solid var(--line);
    background: #f4eee2;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
}
.leaderboard th[aria-sort] { color: var(--accent); font-weight: 700; }
.leaderboard td { height: 53px; border-bottom: 1px solid var(--line); }
.leaderboard .ranking { width: 63px; text-align: center; }
.rank-number { color: var(--muted); font: 400 16px/1 var(--number); }
.rank-number.top { color: var(--accent); font-size: 22px; }
.leaderboard .numeric { text-align: right; white-space: nowrap; }
.leaderboard .score { font-weight: 700; }
.account-row:hover { background: #f8f2e7; }
.account-row[aria-selected="true"] { background: var(--selected); }
.account-row[aria-selected="true"] td:first-child { box-shadow: inset 2px 0 var(--accent); }
.account-toggle, .role-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 1px;
    border: 0;
    background: transparent;
    font-weight: 700;
    text-align: left;
    overflow-wrap: anywhere;
}
.account-toggle::before {
    flex: 0 0 5px;
    width: 5px;
    height: 5px;
    transform: rotate(-45deg);
    border-right: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
    content: "";
}
.account-toggle[aria-expanded="true"]::before { transform: rotate(45deg) translateY(-2px); }
.account-note { color: var(--muted); font-size: 12px; }
.leaderboard .expanded-cell { height: auto; padding: 8px 14px 8px 76px; background: #faf5ea; }
.role-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.role-list li + li { border-top: 1px solid var(--line); }
.role-toggle[aria-pressed="true"] { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.role-list small { flex: none; color: var(--muted); font-size: 12px; }
.board-bottom { display: flex; justify-content: space-between; gap: 10px; padding-top: 12px; color: var(--muted); font-size: 12px; }
.pages { display: flex; align-items: center; gap: 12px; }
.pages button { padding: 1px 0; border: 0; background: none; }
.pages button:disabled { color: var(--muted); opacity: .55; cursor: default; }
.message { margin-block: 20px; color: var(--muted); }
.message a, .text-link { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.empty-cell { color: var(--muted); text-align: center; }

.character-summary {
    align-self: start;
    margin-top: 19px;
    padding: 22px 23px 18px;
    border: 1px solid var(--line);
    border-top: 2px solid #a18a61;
    background: var(--panel);
}
.caption { color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.character-summary h2 { margin-top: 5px; font: 700 30px/1.2 var(--serif); overflow-wrap: anywhere; }
.role-meta { margin-top: 8px; color: var(--muted); font-size: 13px; }
.stats { display: flex; flex-wrap: wrap; gap: 24px; }
.stats dt { color: var(--muted); font-size: 11px; white-space: nowrap; }
.stats dd { margin-top: 4px; color: var(--accent); font: 400 27px/1 var(--number); }
.character-summary .stats { margin-block: 21px 17px; padding-block: 14px; border-block: 1px solid var(--line); }
.character-summary h3 { margin-bottom: 8px; font-size: 13px; }
.preview-items li, .equipment button { display: flex; align-items: center; gap: 10px; }
.preview-items li { padding: 6px 0; overflow-wrap: anywhere; }
.item-art {
    display: block;
    flex: none;
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 1px solid #746246;
    background: #2b2426;
    object-fit: contain;
}
.item-art.empty {
    display: grid;
    place-items: center;
    border-color: var(--line);
    background: #e9dfcc;
    color: var(--muted);
    font-size: 11px;
}
.item-slot { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.view-build { display: block; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--accent); font-weight: 700; }
.view-build:hover { text-decoration: underline; text-underline-offset: 4px; }

.build-header { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.build-header h1 { font-size: 43px; overflow-wrap: anywhere; }
.back { display: inline-block; margin-bottom: 23px; }
.build-tabs { display: flex; flex-wrap: wrap; gap: 25px; margin-top: 25px; border-bottom: 1px solid var(--strong); }
.build-tabs button {
    margin-bottom: -1px;
    padding: 6px 0 12px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--muted);
}
.build-tabs [aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.build-content { margin-top: 23px; }
.equipment-layout { display: grid; grid-template-columns: minmax(205px, 35%) minmax(0, 1fr); gap: 24px; }
.equipment { border-top: 1px solid var(--line); }
.equipment li { border-bottom: 1px solid var(--line); }
.equipment button { width: 100%; padding: 8px; border: 0; background: transparent; text-align: left; }
.equipment button:hover { background: #f8f2e7; }
.equipment [aria-pressed="true"] { background: var(--selected); color: var(--accent); }
.item-details {
    align-self: start;
    padding: 21px 23px;
    border: 1px solid #615342;
    background: #302923;
    color: #f2e9d7;
    overflow-wrap: anywhere;
}
.item-details h2 { color: #eac791; font-size: 18px; }
.item-details .caption { padding-bottom: 12px; border-bottom: 1px solid #6d5b47; color: #decdad; }
.item-details ul { display: grid; gap: 6px; padding-top: 12px; }
.trees { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 298px), 1fr)); gap: 26px; }
.tree { min-width: 0; }
.tree h2 { padding-bottom: 8px; border-bottom: 1px solid var(--strong); font: 700 24px/1.4 var(--serif); }
.tree li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 1px; border-bottom: 1px solid var(--line); }
.tree li span:last-child { flex: none; color: var(--accent); font-variant-numeric: tabular-nums; }
.site-footer { margin-top: auto; padding: 17px var(--padding); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

@media (max-width: 1120px) {
    :root { --padding: 28px; }
    .board-layout { grid-template-columns: minmax(0, 1fr) 250px; gap: 22px; }
    .character-summary { padding-inline: 17px; }
}
@media (max-width: 900px) {
    .site { width: 100%; border: 0; }
    body::before, body::after { display: none; }
}
@media (max-width: 700px) {
    :root { --padding: 16px; }
    .site-header { min-height: 62px; flex-wrap: wrap; gap: 12px; padding-top: 13px; }
    .wordmark { width: 100%; font-size: 22px; }
    .site-header nav { min-height: 36px; gap: 24px; }
    main { padding-top: 25px; }
    h1 { font-size: 43px; }
    .heading-meta { position: static; margin-top: 10px; }
    .board-layout, .equipment-layout { grid-template-columns: 1fr; }
    .leaderboard th, .leaderboard td { padding-inline: 6px; }
    .leaderboard .ranking { width: 34px; }
    .leaderboard .corruption { display: none; }
    .leaderboard .expanded-cell { padding-inline: 25px 8px; }
    .role-list small { white-space: normal; text-align: right; }
    .character-summary { margin-top: 0; }
    .build-header { align-items: start; flex-direction: column; }
    .build-header h1 { font-size: 35px; }
    .build-tabs { gap: 16px; }
}
