:root {
    --page-bg: #ece5dc;
    --page-paper: rgba(246, 241, 234, 0.9);
    --page-paper-strong: rgba(255, 255, 255, 0.8);
    --page-soft: #f9f5ef;
    --page-text: #141210;
    --page-muted: #70675f;
    --page-line: rgba(132, 103, 80, 0.2);
    --page-line-strong: rgba(132, 103, 80, 0.3);
    --page-red: #b10000;
    --page-red-deep: #860000;
    --page-red-soft: rgba(177, 0, 0, 0.09);
    --page-dark: #1e1a17;
    --page-gold: #c28b48;
    --page-green: #2b7b65;
    --page-danger: #bf3a3a;
    --page-shadow: 0 24px 54px rgba(56, 21, 12, 0.15);
    --page-shadow-soft: 0 14px 30px rgba(56, 21, 12, 0.1);
    --page-radius: 26px;
    --numeric-col-width: 96px;
    --rank-col-width: 76px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--page-text);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(177, 0, 0, 0.08) 60%, rgba(177, 0, 0, 0.18)),
        radial-gradient(circle at 8% 2%, rgba(255, 255, 255, 0.74), transparent 26%),
        linear-gradient(145deg, var(--page-bg) 0%, #f6f1ea 50%, #fffaf4 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(177, 0, 0, 0.07) 1px, transparent 1px),
        linear-gradient(rgba(177, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent 72%);
}

a {
    color: inherit;
    text-decoration: none;
}

.page {
    position: relative;
    z-index: 1;
    width: min(1360px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 46px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--page-line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--page-muted);
    box-shadow: var(--page-shadow-soft);
}

.view-switch {
    position: fixed;
    left: 18px;
    top: 118px;
    z-index: 8;
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--page-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
    box-shadow: var(--page-shadow-soft);
}

.view-link {
    min-width: 82px;
    min-height: 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--page-muted);
    font-size: 14px;
    font-weight: 900;
}

.view-link.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--page-red), #d24c43);
    box-shadow: 0 10px 20px rgba(177, 0, 0, 0.2);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.32fr) minmax(320px, 410px);
    gap: 18px;
    align-items: stretch;
    margin-bottom: 20px;
}

.hero-main,
.hero-side,
.panel,
.chart-card,
.table-shell,
.side-panel,
.empty-state {
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--page-radius);
    background: var(--page-paper);
    backdrop-filter: blur(16px);
    box-shadow: var(--page-shadow);
}

.hero-main {
    position: relative;
    overflow: hidden;
    padding: 32px;
    background:
        linear-gradient(90deg, rgba(255, 252, 249, 0.98) 0%, rgba(255, 252, 249, 0.92) 48%, rgba(255, 252, 249, 0.78) 100%),
        linear-gradient(0deg, rgba(177, 0, 0, 0.08), transparent),
        url("../img/hero-home.jpg");
    background-size: cover;
    background-position: right center;
}

.hero-main::before {
    content: "DATA";
    position: absolute;
    right: 30px;
    top: 18px;
    color: rgba(177, 0, 0, 0.12);
    font-family: Georgia, "Times New Roman", "Songti SC", serif;
    font-size: clamp(70px, 8vw, 124px);
    line-height: 0.9;
    font-weight: 700;
    letter-spacing: -0.08em;
}

.hero-main::after {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(177, 0, 0, 0.14);
    border-radius: 18px;
    pointer-events: none;
}

.hero-main > * {
    position: relative;
    z-index: 1;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--page-red);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    color: var(--page-dark);
    font-family: Georgia, "Times New Roman", "Songti SC", serif;
    font-size: clamp(32px, 4.6vw, 50px);
    line-height: 1.04;
}

.subtle,
.section-subtitle {
    color: var(--page-muted);
    font-size: 14px;
    line-height: 1.8;
}

.subtle {
    max-width: 720px;
    margin-top: 12px;
}

.hero-side {
    padding: 20px;
    display: grid;
    gap: 14px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(246, 241, 234, 0.88));
}

.status-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 800;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--page-dark);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--page-green);
    box-shadow: 0 0 0 6px rgba(43, 123, 101, 0.18);
}

.status-meta {
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid var(--page-line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--page-muted);
    font-size: 13px;
    line-height: 1.85;
}

.status-error {
    color: var(--page-danger);
    font-size: 13px;
    line-height: 1.5;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.btn,
.select {
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--page-line-strong);
    background: rgba(255, 255, 255, 0.86);
    color: var(--page-text);
    padding: 0 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.btn {
    cursor: pointer;
    font-weight: 900;
    color: #fff;
    border: 0;
    background: linear-gradient(135deg, var(--page-red), #d24c43);
    box-shadow: 0 12px 22px rgba(177, 0, 0, 0.2);
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(177, 0, 0, 0.24);
}

.btn-secondary {
    background: linear-gradient(135deg, #2b2a2a 0%, #5b5550 100%);
    box-shadow: 0 12px 22px rgba(30, 26, 23, 0.18);
}

.btn:disabled {
    cursor: not-allowed;
    color: #f5f3f0;
    background: #aaa6a2;
    box-shadow: none;
    opacity: 0.78;
    transform: none;
}

.select {
    min-width: 210px;
    cursor: pointer;
}

.refresh-msg {
    min-height: 16px;
    color: var(--page-muted);
    font-size: 12px;
}

.section-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 20px;
}

.panel {
    padding: 20px;
    background: rgba(255, 255, 255, 0.84);
}

.section-title {
    margin: 0;
    color: var(--page-dark);
    font-size: 22px;
    letter-spacing: 0;
}

.chart-wrap {
    margin-top: 16px;
    height: 320px;
    padding: 10px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 251, 247, 0.96), rgba(246, 241, 234, 0.92));
    border: 1px solid var(--page-line);
}

.chart-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.member-switch {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
}

.member-toggle {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--page-line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--page-muted);
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
}

.member-toggle.is-active {
    border-color: rgba(177, 0, 0, 0.34);
    background: rgba(177, 0, 0, 0.08);
    color: var(--page-red);
}

.summary-table,
.xunyi-table,
.baidu-table {
    margin-top: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.86);
}

.summary-table table {
    min-width: 1080px;
}

.xunyi-table table {
    min-width: 840px;
}

.baidu-table table {
    min-width: 720px;
}

.summary-rank {
    width: 36px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(177, 0, 0, 0.1);
    color: var(--page-red);
    font-size: 12px;
    font-weight: 900;
}

.summary-member {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.summary-name {
    color: var(--page-dark);
    font-size: 15px;
    font-weight: 900;
}

.summary-name:hover,
.text-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.summary-time,
.summary-title {
    color: var(--page-muted);
    font-size: 12px;
    line-height: 1.45;
}

.summary-title {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-number,
.number-cell,
.side-row strong {
    color: var(--page-dark);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.metric-stack,
.comparison-member {
    display: flex;
    flex-direction: column;
}

.metric-stack {
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.metric-main {
    line-height: 1.35;
}

.metric-delta {
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.metric-delta.is-leading {
    color: var(--page-red);
}

.metric-delta.is-behind {
    color: var(--page-green);
}

.metric-delta.is-even {
    color: var(--page-muted);
}

.comparison-member {
    gap: 4px;
}

.comparison-member span,
.comparison-label {
    color: var(--page-muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.comparison-row td {
    background: rgba(177, 0, 0, 0.025);
}

.summary-table th:nth-child(1),
.summary-table td:nth-child(1) {
    width: var(--rank-col-width);
    min-width: var(--rank-col-width);
    max-width: var(--rank-col-width);
    text-align: center;
}

.summary-table th:nth-child(n + 4),
.summary-table td:nth-child(n + 4),
.xunyi-table th:nth-child(n + 2),
.xunyi-table td:nth-child(n + 2),
.baidu-table th:nth-child(n + 2),
.baidu-table td:nth-child(n + 2),
.detail-layout .table-shell th:nth-child(n + 2),
.detail-layout .table-shell td:nth-child(n + 2),
.summary-number,
.number-cell,
.side-row strong {
    width: var(--numeric-col-width);
    min-width: var(--numeric-col-width);
    max-width: var(--numeric-col-width);
    text-align: center;
}

.status-ok {
    color: var(--page-green);
    font-weight: 800;
}

.status-warn {
    color: var(--page-danger);
    font-weight: 800;
}

.detail-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.side-panel {
    padding: 18px;
    background: rgba(255, 255, 255, 0.88);
}

.side-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--page-line);
}

.side-row:last-child {
    border-bottom: 0;
}

.side-row span {
    color: var(--page-muted);
    font-size: 13px;
}

.table-shell {
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 15px 18px;
    text-align: left;
    border-bottom: 1px solid var(--page-line);
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    background: #f7ede4;
    color: #9a5b2d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

td {
    color: #302925;
}

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

tr:hover td {
    background: rgba(177, 0, 0, 0.04);
}

.title-cell {
    max-width: 520px;
    color: var(--page-muted);
    line-height: 1.65;
}

.empty-state {
    padding: 36px;
    background: rgba(255, 255, 255, 0.88);
    text-align: center;
}

.empty-state .action-row {
    justify-content: center;
}

.footer {
    margin-top: 24px;
    color: var(--page-muted);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 1120px) {
    .hero,
    .section-grid,
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .page {
        width: min(calc(100% - clamp(12px, 3vw, 18px)), 1360px);
        padding-top: 16px;
    }

    .view-switch {
        position: static;
        display: flex;
        width: max-content;
        margin: 0 0 12px;
    }

    .hero-main,
    .hero-side,
    .panel,
    .side-panel,
    .empty-state {
        padding: 16px;
    }

    .hero-main::before {
        right: 12px;
        top: 12px;
        font-size: 82px;
    }

    h1 {
        font-size: 30px;
        line-height: 1.12;
    }

    .section-title {
        font-size: 18px;
        line-height: 1.35;
    }

    .action-row {
        align-items: stretch;
    }

    .btn,
    .select {
        width: 100%;
    }

    .chart-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .member-switch {
        width: 100%;
        padding: 2px 0 8px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .member-toggle {
        min-width: 64px;
        min-height: 32px;
        padding: 0 10px;
        scroll-snap-align: start;
    }

    .chart-wrap {
        height: clamp(220px, 68vw, 280px);
        padding: 6px;
        border-radius: 16px;
    }

    .chart-wrap canvas {
        max-width: 100%;
    }

    .table-shell {
        padding: 0;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.86);
        border: 1px solid rgba(255, 255, 255, 0.8);
        box-shadow: var(--page-shadow);
        border-radius: 22px;
    }

    .table-scroll {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    table,
    .summary-table table,
    .xunyi-table table,
    .baidu-table table {
        min-width: 0;
        border-collapse: collapse;
        border-spacing: 0;
        font-size: 13px;
    }

    thead {
        display: table-header-group;
    }

    tbody {
        display: table-row-group;
    }

    tr {
        display: table-row;
    }

    th,
    td {
        padding: 11px 12px;
        border-bottom: 1px solid var(--page-line);
    }

    td {
        display: table-cell;
        min-width: 0;
        line-height: 1.45;
    }

    td::before {
        content: none;
    }

    tr:hover td {
        background: rgba(177, 0, 0, 0.03);
    }

    .summary-table table {
        min-width: 960px;
    }

    .xunyi-table table {
        min-width: 506px;
        table-layout: fixed;
    }

    .xunyi-table th:first-child,
    .xunyi-table td:first-child {
        width: 96px;
        min-width: 96px;
        max-width: 96px;
    }

    .baidu-table table {
        min-width: 342px;
        table-layout: fixed;
    }

    .baidu-table th:first-child,
    .baidu-table td:first-child {
        width: 96px;
        min-width: 96px;
        max-width: 96px;
    }

    .detail-layout .table-shell table {
        min-width: 720px;
    }

    .summary-table td:nth-child(3) {
        max-width: 180px;
    }

    .summary-member {
        min-width: 0;
    }

    .summary-title {
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .summary-time,
    .summary-title,
    .title-cell {
        font-size: 12px;
        line-height: 1.55;
    }

    .title-cell {
        max-width: 260px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    :root {
        --numeric-col-width: 82px;
        --rank-col-width: 64px;
    }
}
