html {
    min-height: 100%;
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(20, 88, 63, 0.85) 0%, transparent 55%),
        radial-gradient(160% 120% at 50% 120%, rgba(6, 35, 26, 0.95) 0%, transparent 60%),
        var(--felt-800);
    background-attachment: fixed;
}

body {
    position: relative;
    isolation: isolate;
    font-family: var(--font-body);
    background: transparent;
    min-height: 100vh;
    padding: 28px 20px;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 40px;
    color: var(--ivory-on-felt);
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 页头 ===== */
header {
    text-align: center;
    margin-bottom: 36px;
    padding-bottom: 22px;
    position: relative;
}

header::after {
    /* 扑克花色装饰带（签名元素之一） */
    content: '♠  ♥  ♦  ♣';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    font-size: 0.95em;
    letter-spacing: 0.5em;
    color: var(--gold);
    opacity: 0.85;
    text-indent: 0.5em;
}

header h1 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 2.6em;
    letter-spacing: 0.01em;
    color: var(--card);
    margin-bottom: 12px;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.app-brand {
    text-align: center;
}

.global-session-action {
    position: absolute;
    z-index: 3;
    top: 2px;
    right: 0;
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 17px;
    border: 1px solid var(--gold-soft);
    border-radius: 999px;
    background: var(--glass-gold-bg);
    color: var(--gold-soft);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 8px 20px rgba(0, 0, 0, 0.28);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    font: 800 0.95rem var(--font-body);
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.global-session-action:hover { background: var(--glass-gold-bg-hover); }
.global-session-action:active { transform: scale(0.98); }
.global-session-action-icon { font-size: 1.25em; line-height: 1; }

.subtitle {
    color: var(--gold-soft);
    font-size: 1.05em;
    letter-spacing: 0.06em;
}

/* ===== App 导航与数据控制栏 ===== */
.app-navigation {
    position: relative;
    z-index: 3;
    display: flex;
    width: fit-content;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto 22px;
    padding: 6px;
    border: 1px solid var(--felt-line);
    border-radius: 999px;
    background: var(--glass-felt-bg);
}

.module-nav-btn {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ivory-dim);
    font: 700 0.95rem var(--font-body);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
}

.module-nav-btn svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

@media (hover: hover) and (pointer: fine) {
    .module-nav-btn:hover {
        color: var(--gold-soft);
        background: rgba(217, 169, 59, 0.1);
    }
}

.module-nav-btn.active {
    color: #2A1E05;
    background: var(--gold);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 4px 10px rgba(0, 0, 0, 0.26);
}

.data-module-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.view-toggle {
    display: flex;
    gap: 8px;
    background: var(--glass-felt-bg);
    padding: 6px;
    border-radius: 999px;
    border: 1px solid var(--felt-line);
}

.toggle-btn {
    padding: 11px 22px;
    border: none;
    background: transparent;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.98em;
    font-weight: 700;
    color: var(--ivory-dim);
    transition: color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, transform 0.1s ease;
}

.toggle-btn:hover {
    color: var(--gold-soft);
    background: rgba(217, 169, 59, 0.12);
}

/* 激活的 tab = 金色筹码 */
.toggle-btn.active {
    color: #2A1E05;
    background: radial-gradient(circle at 50% 35%, var(--gold-soft) 0%, var(--gold) 60%, var(--gold-deep) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.32),
        0 4px 10px rgba(0, 0, 0, 0.32);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.toggle-btn.active:hover {
    color: #2A1E05;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-selector label {
    font-weight: 600;
    color: var(--ivory-on-felt);
}

.date-selector select {
    padding: 11px 48px 11px 18px;
    border: 1px solid var(--card-edge);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1em;
    cursor: pointer;
    background: var(--card);
    background-image: var(--select-chevron);
    background-position: right 18px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
    color: var(--ink);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    min-width: 220px;
    -webkit-appearance: none;
    appearance: none;
}

.date-selector select:hover {
    border-color: var(--gold);
}

.date-selector select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(217, 169, 59, 0.3);
}

.daily-share-btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border: 1px solid var(--gold);
    border-radius: var(--radius-sm);
    background: var(--gold);
    color: #2A1E05;
    font: 700 0.95rem var(--font-body);
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.daily-share-btn:hover { background: var(--gold-soft); }
.daily-share-btn:active:not(:disabled) { transform: scale(0.98); }
.daily-share-btn:focus-visible { outline: 3px solid rgba(240, 206, 122, 0.45); outline-offset: 2px; }
.daily-share-btn:disabled { cursor: wait; opacity: 0.62; }
.admin-toast.error { border-left: 4px solid var(--loss); }

/* ===== 数据区 ===== */
.data-container {
    margin-bottom: 30px;
}

.loading, .error {
    text-align: center;
    padding: 40px;
    font-size: 1.15em;
    color: var(--ivory-dim);
}

.error {
    color: #FFD7D7;
    background: rgba(197, 48, 58, 0.18);
    border: 1px solid rgba(197, 48, 58, 0.45);
    border-radius: var(--radius-sm);
    padding: 20px;
}

/* 表格 = 发到桌面的牌面 */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--card-edge);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    color: var(--ink);
}

thead {
    background: linear-gradient(180deg, var(--felt-600) 0%, var(--felt-700) 100%);
    color: var(--card);
}

th {
    padding: 15px 16px;
    text-align: left;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.02em;
    letter-spacing: 0.03em;
    color: var(--gold-soft);
    border-bottom: 2px solid var(--gold);
}

th.sortable {
    position: relative;
    transition: background 0.2s ease;
}

th.sortable:hover {
    background: rgba(217, 169, 59, 0.16);
    color: var(--card);
}

.sort-indicator {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.9em;
    color: var(--gold);
}

th:first-child { border-top-left-radius: var(--radius); }
th:last-child { border-top-right-radius: var(--radius); }

tbody tr {
    border-bottom: 1px solid var(--card-edge);
    transition: background 0.2s ease;
}

tbody tr:nth-child(even) {
    background: rgba(14, 69, 54, 0.04);
}

tbody tr:hover {
    background: rgba(217, 169, 59, 0.12);
}

tbody tr:last-child { border-bottom: none; }

td {
    padding: 13px 16px;
    font-size: 1em;
    font-variant-numeric: tabular-nums;
}

/* 姓名列用正文字体（含中文），数字列用等宽 */
td:not(:first-child) {
    font-family: var(--font-mono);
    font-weight: 500;
}

td:first-child {
    font-weight: 700;
    color: var(--ink);
}

.positive { color: var(--win); font-weight: 700; }
.negative { color: var(--loss); font-weight: 700; }
.zero { color: var(--push); }

.highlight-max {
    background: var(--hl-win) !important;
    box-shadow: inset 4px 0 0 var(--win);
}

.highlight-min {
    background: var(--hl-loss) !important;
    box-shadow: inset 4px 0 0 var(--loss);
}

/* ===== 统计摘要 ===== */
.summary {
    margin-top: 30px;
    padding: 26px;
    background: rgba(6, 35, 26, 0.4);
    border: 1px solid var(--felt-line);
    border-radius: var(--radius);
}

.summary-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.summary h3 {
    font-family: var(--font-display);
    font-weight: 700;
    margin: 0;
    color: var(--gold-soft);
    font-size: 1.45em;
}

.summary-status {
    flex: 0 0 auto;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.82em;
    font-weight: 700;
    line-height: 1.2;
}

.summary-status.is-success {
    color: var(--win);
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
}

.summary-status.is-error {
    color: var(--loss);
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.3);
}

.summary-status.is-warning {
    color: var(--gold-soft);
    background: rgba(217, 169, 59, 0.14);
    border-color: rgba(217, 169, 59, 0.36);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 15px;
}

.summary-item {
    background: var(--card);
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-edge);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .summary-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    }
}

.summary-item-label {
    font-size: 0.9em;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.summary-item-value {
    font-family: var(--font-mono);
    font-size: 1.5em;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.summary-item-value.positive { color: var(--win); }
.summary-item-value.negative { color: var(--loss); }
.summary-item-value.zero { color: var(--push); }

.daily-summary .summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.daily-summary .summary-item--result {
    grid-column: span 3;
}

.summary-item--result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: end;
    column-gap: 16px;
    row-gap: 6px;
}

.summary-item--result .summary-item-label {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.summary-item--result .summary-item-value {
    grid-column: 1;
    min-width: 0;
}

.summary-item--result > div:last-child:not(.summary-item-value) {
    grid-column: 2;
    align-self: end;
    margin-top: 0 !important;
    text-align: right;
    white-space: nowrap;
}

.daily-summary .summary-item--compact {
    grid-column: span 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: end;
    column-gap: 16px;
    row-gap: 6px;
    padding: 13px 15px;
    box-shadow: none;
}

.summary-item--compact .summary-item-label {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.summary-item--compact .summary-item-value {
    grid-column: 1;
}

.summary-item--compact > div:last-child:not(.summary-item-value) {
    grid-column: 2;
    align-self: end;
    margin-top: 0 !important;
    text-align: right;
    white-space: nowrap;
}

.daily-summary .summary-item--compact .summary-item-value {
    font-size: 1.3em;
}

.total-summary .summary-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.total-summary .summary-item--result {
    grid-column: span 4;
}

.total-summary .summary-item--compact {
    grid-column: span 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: end;
    column-gap: 16px;
    row-gap: 6px;
    padding: 13px 15px;
    box-shadow: none;
}

.total-summary .summary-item--compact .summary-item-value {
    font-size: 1.3em;
}
