/*
 * 内蒙古网球圈 —— 全站视觉升级层
 *
 * 本文件最后加载，只覆写既有组件的外观与排布，
 * 不改变页面结构和业务逻辑。原有类名保持不变，
 * 因此榜单、社群、场馆和后台页面会同时获得升级。
 */

/* ---------------------------------------------------------------
 * 1. 设计令牌
 * ------------------------------------------------------------- */
:root {
    color-scheme: light;

    --ink-950: #06140f;
    --ink-900: #0a211a;
    --ink-800: #103328;
    --ink-700: #164636;

    --green-950: #071a15;
    --green-900: #0b211b;
    --green-800: #123d31;
    --green-700: #146b4d;
    --green-600: #16865d;
    --green-500: #20a672;

    --lime: #d7f23f;
    --lime-strong: #c6e823;
    --lime-soft: #f1fac6;

    --orange: #ef6b42;
    --blue: #2d69c4;
    --red: #cf3f4d;
    --purple: #7747d8;
    --gold: #c9a227;

    --text: #14221c;
    --text-soft: #37463f;
    --muted: #5d6b64;
    --line: #dce4df;
    --line-strong: #c7d3cc;

    --surface: #ffffff;
    --surface-soft: #f6f8f7;
    --surface-tint: #eef4f0;
    --background: #f0f4f1;

    --radius: 16px;
    --radius-small: 10px;
    --radius-pill: 999px;

    --shadow-small: 0 1px 2px rgba(6, 20, 15, .04), 0 8px 24px -18px rgba(6, 20, 15, .35);
    --shadow: 0 2px 4px rgba(6, 20, 15, .04), 0 24px 48px -28px rgba(6, 20, 15, .38);

    --header-h: 68px;
    --tabbar-h: 62px;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
        Arial, sans-serif;
}

/* ---------------------------------------------------------------
 * 2. 基础排版
 * ------------------------------------------------------------- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    color: var(--text);
    background-color: var(--background);
    background-image:
        radial-gradient(1100px 520px at 12% -8%, rgba(215, 242, 63, .10), transparent 62%),
        radial-gradient(900px 480px at 98% 2%, rgba(22, 134, 93, .10), transparent 58%);
    background-attachment: fixed;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    color: var(--ink-900);
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1.25;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

a {
    color: var(--green-700);
    text-underline-offset: 3px;
    transition: color .16s ease;
}

a:hover {
    color: var(--green-900);
}

strong {
    font-weight: 800;
}

hr {
    height: 1px;
    border: 0;
    background: var(--line);
}

::selection {
    color: var(--ink-950);
    background: var(--lime);
}

:focus-visible {
    outline: 3px solid rgba(22, 134, 93, .45);
    outline-offset: 3px;
}

/* 跳转到正文 */
.skip-link {
    position: absolute;
    z-index: 300;
    top: 8px;
    left: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-small);
    color: var(--ink-950);
    background: var(--lime);
    font-weight: 800;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform .18s ease;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

/* ---------------------------------------------------------------
 * 3. 页面骨架
 * ------------------------------------------------------------- */
.site-shell {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
}

.main-content {
    min-height: 62vh;
}

body:not(.page-tennis_passport) .main-content {
    padding-bottom: 8px;
}

/* ---------------------------------------------------------------
 * 4. 页头与导航
 * ------------------------------------------------------------- */
.site-header {
    position: sticky;
    z-index: 120;
    top: 12px;

    display: flex;
    min-height: var(--header-h);
    align-items: center;
    gap: 18px;

    margin: 12px 0 26px;
    padding: 10px 14px;

    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 18px;

    color: #fff;
    background: linear-gradient(180deg, rgba(10, 33, 26, .985), rgba(6, 20, 15, .985));
    box-shadow: 0 18px 40px -22px rgba(6, 20, 15, .65);

    transition: box-shadow .2s ease, background .2s ease;
}

@supports (backdrop-filter: blur(2px)) {
    .site-header {
        background: linear-gradient(180deg, rgba(10, 33, 26, .90), rgba(6, 20, 15, .94));
        backdrop-filter: blur(16px) saturate(130%);
        -webkit-backdrop-filter: blur(16px) saturate(130%);
    }
}

.site-header.is-scrolled {
    box-shadow: 0 22px 48px -20px rgba(6, 20, 15, .75);
}

.brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    color: #fff;
    text-decoration: none;
}

.brand:hover {
    color: #fff;
}

.brand-ball {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 0 4px rgba(215, 242, 63, .13);
    transform: rotate(-16deg);
}

.brand-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.brand strong {
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .01em;
    line-height: 1.2;
    white-space: nowrap;
}

.brand small {
    overflow: hidden;
    color: rgba(255, 255, 255, .56);
    font-size: 11px;
    letter-spacing: .02em;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    min-width: 0;
    align-items: center;
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 4px;
}

.main-nav a,
.main-nav .nav-logout {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    border-radius: 9px;
    color: rgba(255, 255, 255, .76);
    background: transparent;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: color .16s ease, background .16s ease;
}

.main-nav a:hover,
.main-nav .nav-logout:hover {
    color: #fff;
    background: rgba(255, 255, 255, .09);
}

.main-nav a[aria-current="page"]:not(.nav-primary) {
    color: var(--lime);
    background: rgba(215, 242, 63, .10);
}

.main-nav a svg,
.main-nav .nav-logout svg {
    width: 15px;
    height: 15px;
    flex: none;
    opacity: .85;
}

.main-nav .nav-primary {
    color: var(--ink-950);
    background: var(--lime);
    box-shadow: 0 6px 16px -8px rgba(215, 242, 63, .55);
}

.main-nav .nav-primary:hover {
    color: var(--ink-950);
    background: var(--lime-strong);
}

.main-nav .nav-danger,
.main-nav .nav-logout {
    color: #ff9ba4;
}

.main-nav .nav-danger:hover,
.main-nav .nav-logout:hover {
    color: #fff;
    background: rgba(207, 63, 77, .22);
}

.main-nav .nav-logout-form {
    display: flex;
    margin: 0;
}

.nav-pin {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-pin::before {
    width: 1px;
    height: 20px;
    margin: 0 6px 0 4px;
    background: rgba(255, 255, 255, .14);
    content: "";
}

.nav-scroll {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 3px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.nav-scroll::-webkit-scrollbar {
    display: none;
}

.message-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    padding: 1px 5px;
    border: 2px solid var(--ink-900);
    border-radius: var(--radius-pill);
    color: #fff;
    background: var(--orange);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
}

.nav-message {
    position: relative;
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 11px;
    color: #fff;
    background: rgba(255, 255, 255, .04);
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, .10);
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 4px 0;
    border-radius: 2px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* 后台页头 */
body[class^="page-admin"] .site-header .main-nav {
    display: flex;
}

@media (max-width: 1080px) {
    /* 后台页头在窄屏保留横向工具栏，不折叠成菜单。 */
    body[class^="page-admin"] .site-header {
        flex-wrap: nowrap;
    }

    body[class^="page-admin"] .site-header .main-nav {
        display: flex;
        width: auto;
        max-height: none;
        flex: 0 1 auto;
        padding: 0;
        overflow-x: auto;
        border-top: 0;
    }

    body[class^="page-admin"] .nav-toggle {
        display: none;
    }
}

.admin-header-role {
    color: rgba(255, 255, 255, .66);
    font-size: 12px;
    white-space: nowrap;
}

/* ---------------------------------------------------------------
 * 5. 首页英雄区
 * ------------------------------------------------------------- */
.hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(250px, .5fr);
    align-items: center;
    gap: 40px;

    overflow: hidden;
    margin-bottom: 22px;
    padding: 52px;

    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 22px;

    color: #fff;
    background: var(--ink-900);
    box-shadow: 0 30px 60px -34px rgba(6, 20, 15, .75);
}

.hero::before {
    position: absolute;
    z-index: -1;
    top: -35%;
    right: -12%;
    width: 62%;
    height: 160%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(215, 242, 63, .16), transparent 72%);
    content: "";
    pointer-events: none;
}

.hero::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-position: center;
    background-size: 96px 96px;
    content: "";
    opacity: .55;
    pointer-events: none;
    mask-image: radial-gradient(120% 90% at 70% 50%, #000 30%, transparent 78%);
    -webkit-mask-image: radial-gradient(120% 90% at 70% 50%, #000 30%, transparent 78%);
}

.page-index .hero {
    min-height: 455px;
    align-items: end;
    padding: 56px;
    background-color: #071a14;
    background-image:
        linear-gradient(92deg, rgba(4, 17, 13, .95) 0%, rgba(4, 17, 13, .82) 42%, rgba(4, 17, 13, .34) 74%, rgba(4, 17, 13, .18) 100%),
        linear-gradient(0deg, rgba(4, 17, 13, .88) 0%, rgba(4, 17, 13, 0) 56%),
        url("/assets/tennis-court-hero.jpg");
    background-position: center 46%;
    background-size: cover;
}

.page-index .hero::before {
    background: radial-gradient(closest-side, rgba(215, 242, 63, .14), transparent 70%);
}

.page-index .hero::after {
    opacity: .22;
}

body:not(.page-index) .hero {
    min-height: 300px;
    align-items: center;
    padding: 40px 44px;
}

body:not(.page-index) .hero:not(:has(.hero-stats)) {
    grid-template-columns: minmax(0, 1fr);
}

.hero-content {
    max-width: 660px;
}

.hero-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 0;

    border: 0;
    border-radius: 0;

    color: var(--lime);
    background: transparent;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    line-height: 1.4;
    text-transform: uppercase;
}

.hero-label::before {
    width: 26px;
    height: 2px;
    border-radius: 2px;
    background: var(--lime);
    content: "";
}

.hero h1,
.hero-title {
    max-width: 760px;
    margin: 16px 0 12px;
    color: #fff;
    font-size: clamp(34px, 4.2vw, 52px);
    font-weight: 850;
    letter-spacing: -.015em;
    line-height: 1.1;
    white-space: normal;
}

.hero p {
    max-width: 580px;
    margin: 0;
    color: rgba(255, 255, 255, .78);
    font-size: 16px;
    line-height: 1.7;
}

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

.hero-actions .btn {
    min-height: 48px;
    padding: 0 22px;
    border-radius: 12px;
    font-size: 15px;
}

.btn-ghost {
    color: #fff;
    background: rgba(255, 255, 255, .06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}

.btn-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, .13);
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.hero-link:hover {
    color: var(--lime);
}

.hero-link span {
    color: var(--lime);
    font-size: 17px;
    line-height: 1;
}

.hero-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin: 22px 0 0;
    padding: 0;
    color: rgba(255, 255, 255, .68);
    font-size: 13px;
    list-style: none;
}

.hero-points li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.hero-points li::before {
    display: grid;
    width: 15px;
    height: 15px;
    place-items: center;
    border-radius: 50%;
    color: var(--ink-950);
    background: var(--lime);
    content: "✓";
    font-size: 9px;
    font-weight: 900;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: center;
    gap: 1px;

    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 14px;

    background: rgba(255, 255, 255, .12);
}

.hero-stat {
    display: block;
    min-height: 96px;
    padding: 16px 18px;

    border: 0;
    border-radius: 0;

    background: rgba(5, 18, 14, .68);
    text-align: left;

    transition: background .18s ease;
}

.hero-stat:hover {
    background: rgba(5, 18, 14, .82);
}

.hero-stat strong {
    display: block;
    margin-bottom: 3px;
    color: var(--lime);
    font-size: 30px;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.1;
}

.hero-stat span {
    color: rgba(255, 255, 255, .68);
    font-size: 12px;
    letter-spacing: .02em;
}

.page-index .hero-stats {
    align-self: end;
    justify-self: end;
    width: min(100%, 330px);
}

/* ---------------------------------------------------------------
 * 6. 首页新增区块：流程与入口
 * ------------------------------------------------------------- */
.home-steps {
    margin-bottom: 22px;
}

.home-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 18px;
}

.home-section-head h2 {
    margin: 0;
    font-size: 22px;
}

.home-section-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.home-section-head .home-section-link {
    color: var(--green-700);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.home-step-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-step {
    position: relative;
    padding: 18px 18px 18px 60px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.home-step-index {
    position: absolute;
    top: 18px;
    left: 18px;

    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;

    border-radius: 9px;
    color: var(--ink-950);
    background: var(--lime);

    font-size: 13px;
    font-weight: 900;
}

.home-step h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.home-step p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.home-entries {
    margin-bottom: 22px;
}

.home-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.home-entry {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;

    padding: 16px 18px;

    border: 1px solid var(--line);
    border-radius: 14px;

    color: var(--text);
    background: var(--surface);
    text-decoration: none;

    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.home-entry:hover {
    transform: translateY(-2px);
    border-color: var(--green-600);
    color: var(--text);
    box-shadow: var(--shadow-small);
}

.home-entry-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;

    border-radius: 11px;
    color: var(--green-800);
    background: var(--surface-tint);
}

.home-entry-icon svg {
    width: 19px;
    height: 19px;
}

.home-entry-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.home-entry-copy strong {
    font-size: 14px;
}

.home-entry-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-entry::after {
    color: var(--line-strong);
    content: "›";
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    transition: color .16s ease, transform .16s ease;
}

.home-entry:hover::after {
    color: var(--green-700);
    transform: translateX(2px);
}

/* 领奖台 */
.podium {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.podium-card {
    position: relative;
    display: grid;
    gap: 8px;

    padding: 18px;

    border: 1px solid var(--line);
    border-radius: 14px;

    background: linear-gradient(180deg, #fff, var(--surface-soft));
}

.podium-card.is-first {
    border-color: rgba(201, 162, 39, .45);
    background: linear-gradient(180deg, #fffdf2, #fff7dd);
}

.podium-rank {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.podium-rank b {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 6px;
    color: #fff;
    background: var(--ink-800);
    font-size: 11px;
}

.podium-card.is-first .podium-rank b {
    color: #503b00;
    background: #f2d060;
}

.podium-card.is-second .podium-rank b {
    color: #34434a;
    background: #dce3e6;
}

.podium-card.is-third .podium-rank b {
    color: #fff;
    background: #c77a49;
}

.podium-player {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.podium-player a {
    overflow: hidden;
    color: var(--ink-900);
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-player a:hover {
    color: var(--green-700);
}

.podium-meta {
    color: var(--muted);
    font-size: 12px;
}

.podium-score {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--green-800);
}

.podium-score strong {
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    line-height: 1.1;
}

.podium-score small {
    color: var(--muted);
    font-size: 11px;
}

/* ---------------------------------------------------------------
 * 7. 面板与标题
 * ------------------------------------------------------------- */
.panel,
.box,
.auth-card,
.table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-small);
}

.panel,
.box {
    margin-bottom: 20px;
    padding: 26px;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin: 0 0 18px;
}

.panel-title h1,
.panel-title h2,
.panel-title h3,
.panel-title h4 {
    margin: 0;
    color: var(--ink-900);
    font-size: 21px;
    line-height: 1.3;
}

.panel-title h2::after {
    display: block;
    width: 28px;
    height: 3px;
    margin-top: 8px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--lime-strong), var(--green-600));
    box-shadow: none;
    content: "";
}

.panel-title .muted,
.panel-title p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* 首页榜单区保持无边框，内部自带卡片 */
.ranking-panel {
    margin: 26px 0 22px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.ranking-panel > .panel-title {
    margin-bottom: 16px;
}

.ranking-panel .panel-title h2 {
    font-size: 24px;
}

/* ---------------------------------------------------------------
 * 8. 按钮
 * ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 7px;

    padding: 9px 17px;

    border: 0;
    border-radius: var(--radius-small);

    font-size: 14px;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;

    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    transform: none;
    opacity: .6;
    box-shadow: none;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(180deg, var(--green-700), var(--green-800));
    box-shadow: 0 10px 22px -12px rgba(18, 61, 49, .65);
}

.btn-primary:hover {
    color: #fff;
    background: linear-gradient(180deg, var(--green-600), var(--green-700));
}

.btn-lime {
    color: var(--ink-950);
    background: var(--lime);
    box-shadow: 0 10px 22px -12px rgba(198, 232, 35, .75);
}

.btn-lime:hover {
    color: var(--ink-950);
    background: var(--lime-strong);
}

.btn-secondary {
    border: 1px solid var(--line-strong);
    color: var(--ink-800);
    background: #fff;
    box-shadow: none;
}

.btn-secondary:hover {
    border-color: var(--green-600);
    color: var(--green-800);
    background: var(--surface-soft);
}

.btn-orange {
    color: #fff;
    background: var(--orange);
}

.btn-blue {
    color: #fff;
    background: var(--blue);
}

.btn-danger {
    color: #fff;
    background: var(--red);
}

.btn-purple {
    color: #fff;
    background: var(--purple);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 12px;
}

/* ---------------------------------------------------------------
 * 9. 表单
 * ------------------------------------------------------------- */
input,
select,
textarea {
    width: 100%;
    min-height: 44px;

    padding: 10px 13px;

    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);

    outline: none;

    color: var(--text);
    background: #fbfcfb;

    font-size: 15px;
    line-height: 1.4;

    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #93a09a;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #b3c3ba;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green-600);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22, 134, 93, .13);
}

input:disabled,
select:disabled,
textarea:disabled {
    color: #69756f;
    background: #edf2ef;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: auto;
    margin-right: 6px;
    accent-color: var(--green-700);
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.help-text {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.filter-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;

    padding: 12px;

    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-small);
}

.filter-form > input:not([type="hidden"]),
.filter-form > select {
    width: auto;
    min-width: 0;
    flex: 1 1 180px;
}

.filter-form > input[type="search"],
.filter-form > input[name="search"] {
    flex: 2 1 240px;
}

.filter-form > .btn,
.filter-form > button {
    width: auto;
    flex: 0 0 auto;
}

.region-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.region-option {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    color: var(--text-soft);
    background: var(--surface-soft);
    font-size: 14px;
    font-weight: 600;
    transition: border-color .16s ease, background .16s ease;
}

.region-option:hover {
    border-color: #aac7ba;
    background: #eef6f2;
}

.region-option:has(input:checked) {
    border-color: var(--green-600);
    background: var(--lime-soft);
}

.region-option input {
    flex: 0 0 auto;
}

.agreement-option {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    font-weight: 500;
}

/* ---------------------------------------------------------------
 * 10. 标签页与地区胶囊
 * ------------------------------------------------------------- */
.tabs,
.region-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 4px;
    overflow: visible;
}

.tabs {
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #e7ede9;
}

.tab {
    display: inline-flex;
    min-width: 0;
    min-height: 42px;
    flex: 1 1 180px;
    align-items: center;
    justify-content: center;

    padding: 9px 16px;

    border-radius: 9px;

    color: #52605a;
    background: transparent;

    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;

    transition: color .16s ease, background .16s ease, box-shadow .16s ease;
}

.tab:hover {
    color: var(--ink-900);
    background: rgba(255, 255, 255, .6);
}

.tab.active {
    color: #fff;
    background: var(--ink-900);
    box-shadow: 0 6px 16px -10px rgba(6, 20, 15, .7);
}

.region-tabs {
    margin: 14px 0 16px;
}

.region-chip {
    display: inline-flex;
    min-height: 34px;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;

    padding: 6px 13px;

    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);

    color: var(--text-soft);
    background: rgba(255, 255, 255, .86);

    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;

    transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.region-chip:hover {
    border-color: var(--green-600);
    color: var(--green-800);
    background: #fff;
}

.region-chip.active {
    border-color: var(--ink-900);
    color: var(--lime);
    background: var(--ink-900);
}

.region-chip svg,
.tab svg {
    width: 15px;
    height: 15px;
    flex: none;
}

/* ---------------------------------------------------------------
 * 11. 榜单与球员卡片
 * ------------------------------------------------------------- */
.player-list {
    display: grid;
    gap: 10px;
}

.player-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;

    min-height: 96px;
    padding: 15px 18px;

    border: 1px solid var(--line);
    border-radius: 14px;

    background: var(--surface);

    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.player-card::before {
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--green-600);
    content: "";
}

.player-card:hover {
    transform: translateY(-2px);
    border-color: #b5c6bd;
    box-shadow: 0 16px 30px -22px rgba(6, 20, 15, .5);
}

.player-card:has(.rank-1)::before {
    background: #d2a514;
}

.player-card:has(.rank-2)::before {
    background: #94a3ab;
}

.player-card:has(.rank-3)::before {
    background: #b87343;
}

.player-card.is-unranked::before {
    background: #cdd8d2;
}

.rank-number {
    display: grid;
    width: 44px;
    height: 44px;
    flex: none;
    place-items: center;

    border: 1px solid var(--line);
    border-radius: 12px;

    color: var(--green-800);
    background: var(--surface-tint);

    font-size: 15px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
}

.rank-number.rank-1 {
    border-color: #e2c765;
    color: #503b00;
    background: linear-gradient(135deg, #ffe9a2, #f0c94a);
    box-shadow: 0 8px 16px -10px rgba(201, 162, 39, .8);
}

.rank-number.rank-2 {
    border-color: #b9c4ca;
    color: #34434a;
    background: linear-gradient(135deg, #eef2f4, #c9d3d8);
    box-shadow: 0 8px 16px -10px rgba(80, 96, 104, .6);
}

.rank-number.rank-3 {
    border-color: #c98254;
    color: #fff;
    background: linear-gradient(135deg, #d99a68, #b06b3c);
    box-shadow: 0 8px 16px -10px rgba(176, 107, 60, .7);
}

.rank-unranked {
    color: var(--muted);
    background: var(--surface-soft);
}

.player-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    color: var(--ink-900);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.3;
}

.player-name a {
    color: inherit;
    text-decoration: none;
}

.player-name a:hover {
    color: var(--green-700);
}

.player-name small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.player-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.player-score {
    display: flex;
    min-width: 200px;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    text-align: right;
}

.player-score strong {
    display: block;
    color: var(--green-800);
    font-size: 26px;
    font-variant-numeric: tabular-nums;
    font-weight: 850;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.player-score small {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.player-score .btn {
    min-height: 38px;
    padding: 7px 14px;
    font-size: 13px;
}

/* ---------------------------------------------------------------
 * 12. 标签与头像
 * ------------------------------------------------------------- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;

    padding: 3px 9px;

    border: 1px solid transparent;
    border-radius: var(--radius-pill);

    color: #5c6b64;
    background: #eef3f0;

    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.5;
    white-space: nowrap;
}

.tag-city {
    border-color: #dceb9c;
    color: var(--green-900);
    background: var(--lime-soft);
}

.tag-success {
    border-color: #c5e9d4;
    color: #17603f;
    background: #e4f7ec;
}

.tag-warning {
    border-color: #f0dc9c;
    color: #755914;
    background: #fff6d6;
}

.tag-danger {
    border-color: #f3c3c3;
    color: #892e2e;
    background: #fdeaea;
}

.avatar {
    display: inline-flex;
    width: 48px;
    height: 48px;
    flex: none;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    color: var(--lime);
    background: var(--green-800);

    font-weight: 700;
    line-height: 1;
    object-fit: cover;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 28px;
}

.player-name .avatar,
.player-name img.avatar {
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
}

/* ---------------------------------------------------------------
 * 13. 表格
 * ------------------------------------------------------------- */
.table-wrap {
    max-width: 100%;
    overflow-x: auto;
    margin-bottom: 24px;
    padding: 6px;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    white-space: nowrap;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 13px;
    vertical-align: middle;
}

thead th {
    position: sticky;
    z-index: 1;
    top: 0;

    border-bottom: 1px solid var(--line-strong);
    border-radius: 8px 8px 0 0;

    color: #4a5a53;
    background: var(--surface-soft);

    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

tbody tr {
    transition: background .14s ease;
}

tbody tr:nth-child(even) {
    background: rgba(246, 248, 247, .75);
}

tbody tr:hover {
    background: #f0f7f3;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td.wrap-cell {
    min-width: 240px;
    max-width: 420px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.table-wrap .inline-form {
    display: inline-flex;
    max-width: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.table-wrap .inline-form input {
    max-width: 180px;
}

.inline-form {
    display: inline;
}

.inline-form input[name="reason"] {
    width: 180px;
    min-height: 36px;
    margin: 3px 4px 3px 0;
    padding: 7px 9px;
}

/* ---------------------------------------------------------------
 * 14. 提示、空状态、分页
 * ------------------------------------------------------------- */
.alert {
    margin-bottom: 18px;
    padding: 13px 16px;

    border: 1px solid transparent;
    border-left-width: 4px;
    border-radius: 10px;

    font-size: 14px;
    font-weight: 600;
}

.alert-success {
    border-color: #bfe6cf;
    border-left-color: #1f9d63;
    color: #14603c;
    background: #ecfaf1;
}

.alert-error {
    border-color: #f2c4c8;
    border-left-color: var(--red);
    color: #8a2730;
    background: #fdf0f1;
}

.alert-warning {
    border-color: #f0dfa8;
    border-left-color: #d9a91f;
    color: #71550f;
    background: #fffaeb;
}

.alert-info {
    border-color: #c3d9f4;
    border-left-color: var(--blue);
    color: #23578e;
    background: #eff6ff;
}

.empty {
    padding: 44px 16px;
    color: var(--muted);
    text-align: center;
}

.empty::before {
    display: block;
    margin-bottom: 8px;
    color: var(--line-strong);
    content: "◎";
    font-size: 30px;
    line-height: 1;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    min-width: 40px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    background: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
}

.pagination a:hover {
    border-color: var(--green-600);
    color: var(--green-800);
}

.pagination .current {
    border-color: var(--ink-900);
    color: #fff;
    background: var(--ink-900);
}

.compact-pagination {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    margin-top: 0;
}

.compact-pagination a,
.compact-pagination span {
    padding: 6px 10px;
    font-size: 12px;
}

/* ---------------------------------------------------------------
 * 15. 个人主页、认证与护照
 * ------------------------------------------------------------- */
.auth-card {
    width: min(620px, 100%);
    margin: 44px auto;
    padding: 34px;

    border-top: 4px solid var(--lime);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin: 0 0 6px;
    color: var(--ink-900);
    font-size: 25px;
    text-align: center;
}

.auth-card > p {
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.auth-secondary {
    margin-top: 20px;
}

.profile-hero {
    position: relative;
    overflow: hidden;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 26px;

    margin-bottom: 20px;
    padding: 32px;

    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 20px;

    color: #fff;
    background:
        radial-gradient(700px 240px at 100% 0%, rgba(215, 242, 63, .12), transparent 70%),
        linear-gradient(135deg, var(--ink-900), var(--green-700));

    box-shadow: 0 26px 50px -34px rgba(6, 20, 15, .8);
}

.profile-hero h1 {
    margin: 0 0 6px;
}

.profile-self-rating {
    margin: 14px 0 0;
    color: rgba(255, 255, 255, .76);
    font-size: 13px;
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.profile-tags span {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    color: var(--ink-950);
    background: var(--lime);
    font-size: 11.5px;
    font-weight: 750;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.score-box {
    min-width: 110px;
    padding: 15px;

    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 13px;

    background: rgba(255, 255, 255, .08);
    text-align: center;

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.score-box strong {
    display: block;
    color: var(--lime);
    font-size: 29px;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.score-box small {
    color: rgba(255, 255, 255, .6);
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    overflow: hidden;
    margin-bottom: 20px;

    border: 1px solid var(--line);
    border-top: 3px solid var(--green-800);
    border-radius: 14px;

    background: #fff;
}

.stat-item {
    padding: 16px;
    border-right: 1px solid var(--line);
    text-align: center;
}

.stat-item:last-child {
    border-right: 0;
}

.stat-item strong {
    display: block;
    color: var(--green-800);
    font-size: 23px;
    font-variant-numeric: tabular-nums;
}

.stat-item span,
.stat-item small {
    color: var(--muted);
    font-size: 12px;
}

.profile-page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.profile-back-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 7px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}

.profile-back-link span {
    color: var(--green-700);
    font-size: 18px;
    line-height: 1;
}

.profile-back-link:hover {
    color: var(--ink-900);
}

.profile-page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.captcha-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    align-items: center;
    gap: 12px;
}

.captcha-row img,
[data-captcha-refresh] {
    display: block;
    width: 120px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
    background: #f0f7f3;
}

/* ---------------------------------------------------------------
 * 16. 内容卡片、社群、场馆、更多功能
 * ------------------------------------------------------------- */
.community-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.community-card {
    display: block;
    padding: 18px;

    border: 1px solid var(--line);
    border-radius: 14px;

    color: inherit;
    background: var(--surface);
    text-decoration: none;

    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.community-card:hover {
    transform: translateY(-2px);
    border-color: var(--green-600);
    color: inherit;
    box-shadow: var(--shadow-small);
}

.community-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.community-card p {
    min-height: 3.2em;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.more-function-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.more-function-link {
    display: grid;
    gap: 3px;
    min-height: 78px;
    padding: 16px;

    border: 1px solid var(--line);
    border-left: 3px solid var(--green-600);
    border-radius: 12px;

    color: var(--text);
    background: #fff;
    text-decoration: none;

    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.more-function-link:hover {
    transform: translateY(-2px);
    border-color: var(--green-600);
    color: var(--text);
    box-shadow: var(--shadow-small);
}

.more-function-link span {
    color: var(--muted);
    font-size: 13px;
}

.more-function-link .function-icon {
    display: grid;
    width: 34px;
    height: 34px;
    margin-bottom: 4px;
    place-items: center;
    border-radius: 9px;
    color: var(--green-800);
    background: var(--surface-tint);
}

.more-function-link .function-icon svg {
    width: 17px;
    height: 17px;
}

.community-composer {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(145deg, #fff 0%, #f7fbf8 100%);
    box-shadow: var(--shadow-small);
}

.community-topic-choice input:checked + span {
    border-color: var(--green-600);
    background: var(--lime-soft);
    color: var(--green-900);
    font-weight: 700;
}

.post-card,
.message-card {
    min-width: 0;
}

.message-card {
    padding: 14px 0;
    border-bottom: 1px dashed var(--line);
}

.message-card:last-child {
    border-bottom: 0;
}

.message-card h3 {
    margin: 0 0 6px;
}

.message-card p {
    margin: 0 0 6px;
    color: var(--text-soft);
    font-size: 14px;
}

.court-benefit-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.court-benefit-card:hover {
    border-color: var(--green-600);
    box-shadow: var(--shadow-small);
}

.court-benefit-card h3 {
    margin: 10px 0 6px;
    font-size: 16px;
}

.court-public-facts span {
    padding: 11px;
    border-radius: 9px;
    background: var(--surface-soft);
    overflow-wrap: anywhere;
}

.checkin-ticket {
    display: inline-grid;
    gap: 3px;
    min-width: 190px;
    margin: 4px 0 14px;
    padding: 12px 15px;
    border-left: 4px solid var(--green-600);
    border-radius: 0 9px 9px 0;
    background: var(--surface-soft);
}

.checkin-ticket strong {
    font-size: 23px;
    font-variant-numeric: tabular-nums;
}

.checkin-ticket small {
    color: var(--muted);
}

/* ---------------------------------------------------------------
 * 17. 规则、数据可视化
 * ------------------------------------------------------------- */
.algorithm-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px 26px;

    border: 1px solid var(--line);
    border-left: 4px solid var(--blue);
    border-radius: 14px;
    background: #f8faf9;
    box-shadow: none;
}

.algorithm-panel .panel-title {
    grid-column: 1 / -1;
    margin: 0;
}

.algorithm-rule {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.75;
}

.algorithm-rule strong {
    color: var(--ink-900);
    font-weight: 800;
}

.h2h-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;

    border: 1px solid rgba(119, 71, 216, .25);
    border-radius: 14px;
    background: #fbf8ff;
}

.h2h-score {
    min-width: 130px;
    color: var(--purple);
    text-align: center;
}

.h2h-score strong {
    display: block;
    font-size: 29px;
    font-variant-numeric: tabular-nums;
}

.elo-trend {
    display: flex;
    min-height: 174px;
    align-items: flex-end;
    gap: 7px;
    padding: 18px 10px 0;
    border-top: 1px solid var(--line);
    border-radius: 10px;
    background:
        repeating-linear-gradient(
            180deg,
            transparent 0 42px,
            rgba(18, 61, 49, .07) 43px 44px
        );
}

.elo-trend-item {
    display: grid;
    min-width: 0;
    height: 154px;
    flex: 1 1 0;
    align-items: end;
    grid-template-rows: auto 1fr auto;
    gap: 4px;
    text-align: center;
}

.elo-trend-score {
    color: var(--green-800);
    font-size: 11px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.elo-trend-bar {
    display: block;
    width: min(100%, 30px);
    min-height: 8px;
    align-self: end;
    justify-self: center;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--green-500), var(--green-700));
}

.elo-trend-item:nth-child(3n + 2) .elo-trend-bar {
    background: linear-gradient(180deg, #4d86dd, var(--blue));
}

.elo-trend-item:nth-child(3n) .elo-trend-bar {
    background: linear-gradient(180deg, #f68e63, var(--orange));
}

.elo-trend-item small {
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

/* 徽章 */
.achievement-list {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    color: #fff;
    font-size: 12.5px;
    font-weight: 750;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .10);
}

.achievement-badge.is-locked {
    border: 1px solid var(--line);
    color: #6f7975;
    background: #e8ecea;
    box-shadow: none;
    filter: grayscale(1);
}

/* ---------------------------------------------------------------
 * 18. 后台轻量适配
 * ------------------------------------------------------------- */
.admin-workspace {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.admin-sidebar {
    position: sticky;
    top: 96px;

    display: grid;
    gap: 16px;

    max-height: calc(100vh - 120px);
    overflow: auto;

    padding: 14px;

    border: 1px solid var(--line);
    border-radius: 14px;

    background: #fff;
    box-shadow: var(--shadow-small);
}

.admin-nav-group h2 {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-nav-group a {
    display: flex;
    min-height: 36px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    padding: 7px 10px;

    border-radius: 8px;
    color: var(--text-soft);
    text-decoration: none;

    font-size: 13px;
    font-weight: 650;

    transition: color .14s ease, background .14s ease;
}

.admin-nav-group a:hover,
.admin-nav-group a[aria-current="page"] {
    color: #fff;
    background: var(--ink-900);
}

.admin-nav-count {
    min-width: 1.4em;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    color: var(--ink-950);
    background: var(--lime);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.admin-stat {
    padding: 18px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--green-600);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-small);
}

.admin-stat strong {
    display: block;
    color: var(--green-800);
    font-size: 27px;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.admin-stat span {
    color: var(--muted);
    font-size: 12px;
}

a.admin-stat {
    display: block;
    color: inherit;
    text-decoration: none;
}

a.admin-stat:hover {
    border-color: var(--green-600);
    color: inherit;
}

.admin-stat.has-work {
    border-color: #f0b9a5;
    background: #fff8f4;
}

.admin-link-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.admin-link-grid a {
    padding: 14px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.admin-link-grid a:hover {
    border-color: var(--green-600);
    color: var(--green-900);
}

.admin-module-tabs {
    position: sticky;
    z-index: 20;
    top: 96px;

    gap: 5px;
    padding: 6px;

    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(240, 244, 241, .94);
    box-shadow: var(--shadow-small);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.audit-json {
    max-width: 420px;
    overflow-wrap: anywhere;
    color: #52615b;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    white-space: pre-wrap;
}

/* ---------------------------------------------------------------
 * 19. 页脚
 * ------------------------------------------------------------- */
.site-footer {
    margin-top: 46px;
    padding: 38px 30px 24px;

    border: 0;
    border-radius: 20px 20px 0 0;

    color: rgba(255, 255, 255, .6);
    background:
        radial-gradient(600px 220px at 8% 0%, rgba(215, 242, 63, .07), transparent 70%),
        var(--ink-950);

    font-size: 13px;
    text-align: left;
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(0, 1fr));
    gap: 28px 24px;
    max-width: 1180px;
    margin: 0 auto;
}

.footer-brand {
    display: grid;
    align-content: start;
    gap: 10px;
}

.footer-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-brand strong {
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.footer-brand p {
    margin: 0;
    max-width: 30em;
    color: rgba(255, 255, 255, .55);
    font-size: 12.5px;
    line-height: 1.75;
}

.footer-col h2 {
    margin: 2px 0 10px;
    color: rgba(255, 255, 255, .92);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.footer-col ul {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-col a {
    color: rgba(255, 255, 255, .6);
    text-decoration: none;
}

.footer-col a:hover {
    color: var(--lime);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 18px;

    max-width: 1180px;
    margin: 26px auto 0;
    padding-top: 18px;

    border-top: 1px solid rgba(255, 255, 255, .1);

    color: rgba(255, 255, 255, .42);
    font-size: 12px;
}

.footer-bottom p {
    margin: 0;
}

.site-footer p {
    margin-bottom: 5px;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.footer-links a {
    color: rgba(255, 255, 255, .62);
}

.footer-links a:hover {
    color: var(--lime);
}

.mobile-access-note {
    display: none;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

/* 后台页脚只保留版权与构建信息，不展示面向球员的站点导航 */
body[class^="page-admin"] .site-footer .footer-links,
body[class^="page-admin"] .site-footer .footer-grid,
body[class^="page-admin"] .site-footer .mobile-access-note {
    display: none;
}

body[class^="page-admin"] .site-footer {
    padding: 20px 24px;
}

body[class^="page-admin"] .footer-bottom {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* ---------------------------------------------------------------
 * 20. 手机底部导航
 * ------------------------------------------------------------- */
.mobile-tabbar {
    display: none;
}

/* ---------------------------------------------------------------
 * 21. 长文
 * ------------------------------------------------------------- */
.prose {
    max-width: 760px;
    margin: 0 auto;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.85;
}

.prose h1 {
    margin-top: 0;
    color: var(--ink-900);
}

.prose h2 {
    margin-top: 34px;
    color: var(--ink-800);
    font-size: 20px;
}

.prose li {
    margin-bottom: 8px;
}

.prose p,
.prose li {
    color: var(--text-soft);
}

/* ---------------------------------------------------------------
 * 22. 响应式
 * ------------------------------------------------------------- */
@media (max-width: 1180px) {
    .main-nav a {
        padding: 7px 9px;
        font-size: 12.5px;
    }

    .site-header {
        gap: 12px;
    }
}

@media (max-width: 1080px) {
    :root {
        --header-h: 60px;
    }

    .site-header {
        top: 0;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0 auto 18px;
        padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
        border-radius: 0 0 18px 18px;
    }

    .brand {
        margin-right: auto;
    }

    .brand-ball {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .brand strong {
        font-size: 17px;
    }

    .nav-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        width: 100%;
        max-height: calc(100vh - 96px);
        flex: 1 1 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        justify-content: stretch;
        gap: 4px;
        overflow-y: auto;
        padding: 8px 0 4px;
        border-top: 1px solid rgba(255, 255, 255, .10);
    }

    .main-nav.is-open {
        display: grid;
    }

    .main-nav .nav-scroll,
    .main-nav .nav-pin {
        display: contents;
    }

    .nav-pin::before {
        display: none;
    }

    .main-nav a,
    .main-nav .nav-logout-form,
    .main-nav .nav-logout {
        min-height: 46px;
        justify-content: flex-start;
        padding: 10px 12px;
        font-size: 13px;
    }

    .main-nav a {
        white-space: normal;
    }

    .main-nav .nav-logout-form {
        display: flex;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr) minmax(230px, .42fr);
        gap: 26px;
        padding: 36px;
    }

    .page-index .hero {
        padding: 40px 34px;
        background-position: center 52%;
    }

    .home-entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-workspace {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        display: none;
        max-height: calc(100vh - 96px);
        margin-bottom: 14px;
    }

    .admin-sidebar.is-open {
        display: grid;
    }
}

@media (max-width: 860px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 32px 26px;
    }

    .hero-stats,
    .page-index .hero-stats {
        justify-self: stretch;
        width: 100%;
    }

    .home-step-grid {
        grid-template-columns: 1fr;
    }

    .podium {
        grid-template-columns: 1fr;
    }

    .player-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .player-score {
        grid-column: 1 / -1;
        min-width: 0;
        justify-content: space-between;
        padding-top: 10px;
        border-top: 1px solid var(--line);
        text-align: left;
    }

    .algorithm-panel,
    .profile-hero,
    .h2h-panel {
        grid-template-columns: 1fr;
    }

    .admin-link-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .site-shell {
        width: min(100% - 20px, 1240px);
    }

    body:not(.is-android-app) {
        padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    }

    .main-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero,
    .page-index .hero,
    body:not(.page-index) .hero {
        min-height: 0;
        padding: 30px 22px 24px;
        border-radius: 18px;
    }

    .hero h1,
    .hero-title,
    .page-index .hero h1,
    .page-index .hero-title {
        font-size: 32px;
        line-height: 1.18;
    }

    .hero p {
        font-size: 14px;
    }

    .hero-actions {
        gap: 10px;
        margin-top: 20px;
    }

    .hero-actions .btn {
        min-height: 46px;
    }

    .hero-stat {
        min-height: 82px;
        padding: 12px 14px;
    }

    .hero-stat strong {
        font-size: 25px;
    }

    .panel,
    .box {
        padding: 18px;
        border-radius: 14px;
    }

    .panel-title h1,
    .panel-title h2,
    .panel-title h3 {
        font-size: 19px;
    }

    .home-entry-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        gap: 22px;
    }

    .site-footer {
        padding: 30px 20px 22px;
        border-radius: 16px 16px 0 0;
    }

    .mobile-tabbar {
        position: fixed;
        z-index: 130;
        right: 0;
        bottom: 0;
        left: 0;

        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 2px;

        padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));

        border-top: 1px solid rgba(255, 255, 255, .08);
        background: rgba(6, 20, 15, .96);
        box-shadow: 0 -10px 30px -18px rgba(6, 20, 15, .8);

        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }

    .mobile-tabbar a {
        display: flex;
        min-height: 48px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;

        border-radius: 10px;

        color: rgba(255, 255, 255, .66);
        font-size: 11px;
        font-weight: 700;
        text-decoration: none;
    }

    .mobile-tabbar a svg {
        width: 19px;
        height: 19px;
    }

    .mobile-tabbar a[aria-current="page"] {
        color: var(--lime);
        background: rgba(215, 242, 63, .10);
    }

    .mobile-access-note {
        display: block;
        margin-top: 10px;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.6;
    }

    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .footer-bottom {
        justify-content: flex-start;
    }

    .table-wrap {
        padding: 4px;
    }
}

@media (max-width: 520px) {
    .site-shell {
        width: min(100% - 14px, 1240px);
    }

    .brand small {
        display: none;
    }

    .brand-ball {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .hero h1,
    .hero-title,
    .page-index .hero h1,
    .page-index .hero-title {
        font-size: 27px;
    }

    .hero-stats,
    .page-index .hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-stat {
        min-height: 76px;
        padding: 11px 12px;
    }

    .hero-stat strong {
        font-size: 22px;
    }

    .hero-stat span {
        font-size: 11px;
    }

    .hero-points {
        gap: 6px 12px;
        font-size: 12px;
    }

    .home-entry {
        padding: 14px 15px;
    }

    .podium-card {
        padding: 15px;
    }

    .ranking-panel .tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .ranking-panel .tab {
        min-width: 0;
        padding: 9px 6px;
        font-size: 11.5px;
        white-space: normal;
    }

    .player-card {
        gap: 12px;
        padding: 14px 13px;
    }

    .rank-number {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .player-name {
        font-size: 15.5px;
    }

    .player-score strong {
        font-size: 22px;
    }

    .player-score small {
        white-space: normal;
    }

    .profile-hero {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .auth-card {
        margin: 18px auto;
        padding: 22px 18px;
    }

    .stat-row {
        grid-template-columns: 1fr;
    }

    .stat-item {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .stat-item:last-child {
        border-bottom: 0;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-col h2 {
        margin-bottom: 8px;
    }

    .filter-form > .btn,
    .filter-form > button {
        width: 100%;
        flex: 1 1 100%;
    }

    .panel-title > .btn,
    .panel-title > a.btn,
    .panel-title > form {
        width: 100%;
        flex: 1 1 100%;
    }

    .captcha-row {
        grid-template-columns: minmax(0, 1fr) 110px;
    }

    .captcha-row img,
    [data-captcha-refresh] {
        width: 110px;
    }
}

@media (max-width: 380px) {
    .hero h1,
    .hero-title,
    .page-index .hero h1,
    .page-index .hero-title {
        font-size: 24px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions .btn,
    .hero-link {
        justify-content: center;
    }

    .mobile-tabbar a {
        font-size: 10px;
    }
}

/* 安卓壳内嵌：贴边、无页脚、留出底栏 */
body.is-android-app {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    background: var(--background);
}

body.is-android-app .site-shell {
    width: 100%;
}

body.is-android-app .site-header {
    top: env(safe-area-inset-top, 0px);
    height: 56px;
    min-height: 56px;
    margin: 0;
    padding: 0 8px 0 14px;
    border: 0;
    border-radius: 0;
}

body.is-android-app .site-footer {
    display: none;
}

body.is-android-app .main-content {
    padding: 0 0 12px;
}

body.is-android-app .page-index .hero {
    min-height: 0;
    margin: 0 0 12px;
    padding: 22px 16px 16px;
    border-radius: 0;
}

body.is-android-app .panel,
body.is-android-app .auth-card,
body.is-android-app .filter-form {
    margin-right: 12px;
    margin-left: 12px;
}

body.is-android-app .mobile-tabbar {
    z-index: 130;
    padding-top: 4px;
    background: rgba(6, 20, 15, .98);
}

body.page-tennis_passport {
    padding-bottom: 0;
}

@media (max-width: 760px) {
    body.page-tennis_passport {
        padding-bottom: 0;
    }

    body.page-tennis_passport .mobile-tabbar,
    body.page-tennis_passport .site-footer {
        display: none;
    }
}

/* 首页领奖台在窄屏保持第一名单列在前 */
@media (max-width: 860px) {
    .podium {
        grid-template-columns: 1fr;
    }
}

/*
 * 旧样式把 .panel-title 的子块设为 flex: 1 1 220px，
 * 在纵向排列（窄屏）时这个基准值会变成 220px 的高度，造成大块空白。
 */
@media (max-width: 520px) {
    .ranking-panel .panel-title,
    .panel-title:has(.compact-pagination) {
        align-items: stretch;
        flex-direction: column;
    }

    .ranking-panel .panel-title > div,
    .panel-title:has(.compact-pagination) > div {
        flex: 0 0 auto;
    }
}

/* .auth-card > p 的外边距会盖掉 .auth-secondary，导致链接紧贴按钮 */
.auth-card > p.auth-secondary {
    margin: 18px 0 0;
    font-size: 14px;
}

/* ---------------------------------------------------------------
 * 23. 动效与打印
 * ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

@media print {
    .site-header,
    .mobile-tabbar,
    .site-footer,
    .nav-toggle,
    .hero::before,
    .hero::after {
        display: none !important;
    }

    body {
        color: #000;
        background: #fff;
    }

    .panel,
    .player-card,
    .table-wrap {
        border-color: #bbb;
        box-shadow: none;
    }

    a {
        color: #000;
        text-decoration: underline;
    }
}
