:root {
    --background: #f7f1e8;
    --surface: #fffdf8;
    --ink: #30241d;
    --accent: #b94c20;
    --line: #ead8c6;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    padding: clamp(10px, 3vw, 30px) 12px;
    background: var(--background);
    color: var(--ink);
    font: 15px/1.5 "Segoe UI", Arial, sans-serif;
}
.wrapper {
    width: min(960px, 100%);
    margin: 0 auto;
    padding: clamp(12px, 3vw, 28px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 7px solid var(--accent);
    border-radius: 20px;
    box-shadow: 0 12px 36px #55351a12;
}
.topbar { display: flex; justify-content: flex-start; }
.back-btn, .home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff4e4;
    color: #773719;
    font-weight: 700;
    text-decoration: none;
}
.leaderboard-header { text-align: center; padding: 4px 0 20px; }
.leaderboard-header img { width: min(300px, 88%); height: auto; display: block; margin: 0 auto 8px; }
.leaderboard-header h1 { font-size: clamp(23px, 4vw, 32px); margin: 0; line-height: 1.3; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tabs button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 45px;
    padding: 8px 5px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #643c25;
    background: #f2e4d5;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: white; }
.tabs button:hover:not([aria-pressed="true"]), .back-btn:hover, .home-btn:hover { background: #f7dcc1; }
a:focus-visible, button:focus-visible { outline: 3px solid #d98a38; outline-offset: 3px; }
.bxh-box, .card { min-width: 0; }
.title {
    font-size: clamp(16px, 2.5vw, 19px);
    font-weight: 750;
    color: #773719;
    margin: 0 0 10px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff0db;
}
.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    table-layout: fixed;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.table th, .table td { padding: 13px 12px; text-align: right; overflow-wrap: anywhere; }
.table th { background: #f4e8da; color: #674a37; font-size: 13px; }
.table th:first-child, .table td:first-child { text-align: left; width: 42%; }
.table td { border-top: 1px solid var(--line); background: #fff; font-variant-numeric: tabular-nums; }
.table tr:nth-child(odd) td { background: #fffcf7; }
.table .top0 td { background: #fff4da; }
.table .name { font-weight: 700; }
.rank {
    display: inline-flex;
    min-width: 28px;
    height: 28px;
    justify-content: center;
    align-items: center;
    padding: 0 4px;
    margin-right: 6px;
    border-radius: 7px;
    background: #eee4d8;
    color: #674a37;
    font-weight: 700;
}
.top0 .rank { background: #f1bd50; color: #513005; }
.top1 .rank { background: #ddd9d5; color: #504b46; }
.top2 .rank { background: #e8b18b; color: #673b1a; }
.power span { display: block; font-size: 12px; color: #674a37; }
.value-box { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; font-weight: 700; }
.value-box img { width: 20px; height: 20px; object-fit: contain; }
.tab { display: none; }
.tab.active { display: block; }
@media (max-width: 480px) {
    .wrapper { border-radius: 14px; }
    .tabs button, .table { font-size: 13px; }
    .table th, .table td { padding: 10px 6px; }
    .rank { min-width: 22px; height: 24px; margin-right: 3px; }
    .power span { font-size: 11px; }
}
