/* ============================================
   余城狼积分系统 - 查询页面样式
   暗色主题，月夜狼嚎风格
   ============================================ */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-card-hover: #1e2a42;
    --border-color: #2a3550;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --blood: #dc2626;
    --blood-light: #ef4444;
    --blood-dark: #991b1b;
    --moon: #fbbf24;
    --moon-dim: #92400e;
    --wolf-blue: #60a5fa;
    --good-green: #22c55e;
    --wolf-red: #f87171;
    --tier-bronze: #cd7f32;
    --tier-silver: #c0c0c0;
    --tier-gold: #ffd700;
    --tier-platinum: #40e0d0;
    --tier-diamond: #00bfff;
    --tier-master: #9333ea;
    --tier-king: #ff4500;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* 背景氛围 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(220, 38, 38, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 0%, rgba(251, 191, 36, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(96, 165, 250, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* 顶部导航 */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.top-bar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.top-bar .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--blood), var(--blood-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    color: white;
}

.top-bar .logo-text {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--blood-light), var(--moon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar .logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 12px;
}

.nav-links {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-links a {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-links a.active {
    color: var(--blood-light);
    background: rgba(220, 38, 38, 0.1);
}

.nav-links .btn-admin {
    margin-left: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}

.nav-links .btn-admin:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* 导航控件容器 */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 搜索框样式 */
#search-input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px 6px 30px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    width: 160px;
    transition: border-color 0.2s, width 0.2s;
}

#search-input:focus {
    border-color: var(--blood);
    width: 200px;
}

.search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    pointer-events: none;
}

/* 汉堡菜单按钮 - 默认隐藏 */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: all 0.3s;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 主内容 */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* 页面标题区 */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.filter-bar select:focus,
.filter-bar input:focus {
    border-color: var(--blood);
}

.filter-bar select {
    cursor: pointer;
}

/* Tab切换 */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    color: var(--blood-light);
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 0;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(220, 38, 38, 0.3);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card .stat-value.blood { color: var(--blood-light); }
.stat-card .stat-value.moon { color: var(--moon); }
.stat-card .stat-value.green { color: var(--good-green); }
.stat-card .stat-value.blue { color: var(--wolf-blue); }

/* 表格 */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

thead th.center { text-align: center; }

tbody tr {
    border-bottom: 1px solid rgba(42, 53, 80, 0.4);
    transition: background 0.15s;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

tbody td {
    padding: 10px 16px;
    color: var(--text-primary);
    vertical-align: middle;
}

tbody td.center { text-align: center; }

/* 排名前三行 */
tbody tr.rank-1 { background: rgba(251, 191, 36, 0.04); }
tbody tr.rank-2 { background: rgba(192, 192, 192, 0.03); }
tbody tr.rank-3 { background: rgba(205, 127, 50, 0.03); }

/* 排名数字 */
.rank-num {
    font-weight: 800;
    font-size: 14px;
    width: 28px;
    text-align: center;
}
.rank-1 .rank-num { color: var(--tier-gold); }
.rank-2 .rank-num { color: var(--tier-silver); }
.rank-3 .rank-num { color: var(--tier-bronze); }

/* 玩家名（可点击） */
.player-name {
    font-weight: 600;
    color: var(--wolf-blue);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s;
}

.player-name:hover {
    color: var(--moon);
    text-decoration: underline;
}

/* 段位徽章 */
.tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* 胜率条 */
.win-rate-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.win-rate-bar .bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.win-rate-bar .bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.win-rate-bar .bar-text {
    font-size: 12px;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
    font-family: 'SF Mono', 'Menlo', monospace;
}

/* 阵营标签 */
.faction-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.faction-good { background: rgba(34, 197, 94, 0.15); color: var(--good-green); }
.faction-wolf { background: rgba(248, 113, 113, 0.15); color: var(--wolf-red); }
.faction-third { background: rgba(251, 191, 36, 0.15); color: var(--moon); }

/* 排序表头 */
.sortable-th { cursor: pointer; user-select: none; }
.sortable-th:hover { color: var(--accent); }

/* MVP标签 */
.mvp-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}
.mvp-gold { background: rgba(251, 191, 36, 0.2); color: var(--moon); }
.mvp-purple { background: rgba(147, 51, 234, 0.2); color: var(--tier-master); }

/* 胜负标记 */
.result-win { color: var(--good-green); font-weight: 600; }
.result-lose { color: var(--wolf-red); font-weight: 600; }

/* 积分变动 */
.rating-change {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 13px;
    font-weight: 600;
}
.rating-up { color: var(--good-green); }
.rating-down { color: var(--wolf-red); }

/* 个人页面 */
.player-header {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 900;
    color: var(--text-muted);
}

.player-info h1 {
    font-size: 28px;
    font-weight: 800;
}

.player-info .player-meta {
    display: flex;
    gap: 16px;
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.player-rating-big {
    font-size: 48px;
    font-weight: 900;
    font-family: 'SF Mono', 'Menlo', monospace;
    line-height: 1;
}

/* 积分曲线图容器 */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    height: 250px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* 对局记录卡片 */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.game-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(220, 38, 38, 0.2);
    transform: translateX(4px);
}

.game-card .game-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.game-card .game-code {
    font-weight: 700;
    font-size: 15px;
    font-family: 'SF Mono', 'Menlo', monospace;
}

.game-card .game-mode {
    font-size: 13px;
    color: var(--text-secondary);
}

.game-card .game-winner {
    font-size: 13px;
    font-weight: 600;
}

.game-card .game-players {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.game-card .game-player-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.game-card .game-player-tag.is-win {
    background: rgba(34, 197, 94, 0.1);
    color: var(--good-green);
}

.game-card .game-player-tag.is-lose {
    background: rgba(248, 113, 113, 0.08);
    color: var(--wolf-red);
    opacity: 0.7;
}

/* 登录弹窗 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    width: 400px;
    max-width: 90vw;
}

.modal h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.modal input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    margin-bottom: 16px;
}

.modal input:focus {
    border-color: var(--blood);
}

.modal .btn-row {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 按钮 */
.btn {
    padding: 8px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--blood);
    color: white;
    border-color: var(--blood);
}

.btn-primary:hover {
    background: var(--blood-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.btn-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--good-green);
    border-color: rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.25);
}

/* Toast通知 */
.toast {
    position: fixed;
    top: 70px;
    right: 24px;
    z-index: 300;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 360px;
}

.toast-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--good-green);
}

.toast-error {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--wolf-red);
}

@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--blood);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
    font-size: 15px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination button {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.pagination button:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.pagination button.active { background: rgba(220, 38, 38, 0.15); color: var(--blood-light); border-color: rgba(220, 38, 38, 0.3); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* 两栏布局 */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group select,
.form-group input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.form-group select:focus,
.form-group input:focus {
    border-color: var(--blood);
}

/* 玩家添加行（录入页面用） */
.player-row {
    display: grid;
    grid-template-columns: 52px minmax(80px,1fr) minmax(110px,1fr) 28px 58px 68px 40px 30px 30px 30px 30px 38px 36px;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(42, 53, 80, 0.3);
}

.player-row input,
.player-row select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

/* 隐藏 */
.hidden { display: none !important; }

/* ============================================
   响应式 - 平板 (<= 768px)
   ============================================ */
@media (max-width: 768px) {
    .main-content { padding: 16px; }
    .top-bar { padding: 0 16px; height: auto; min-height: 50px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 6px; }
    .top-bar .logo-sub { display: none; }
    .top-bar .logo-text { font-size: 15px; }
    .nav-links { gap: 2px; flex-wrap: wrap; }
    .nav-links a { padding: 5px 8px; font-size: 12px; }
    .nav-links .btn-admin { margin-left: 2px; padding: 5px 10px; font-size: 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .player-row { grid-template-columns: 40px 1fr 80px 50px 50px; }
    .player-row > :nth-child(n+6) { display: none; }
    .page-header h1 { font-size: 20px; }
    .player-header { flex-direction: column; gap: 16px; }
    .player-info h1 { font-size: 22px; }
    .player-rating-big { font-size: 36px; }
    .chart-container { height: 200px; padding: 12px; }
    .game-card { padding: 12px 14px; }
    .filter-bar { gap: 8px; }
    .filter-bar select, .filter-bar input { font-size: 13px; padding: 7px 10px; }
    .modal { padding: 24px; }
    .toast { right: 16px; left: 16px; max-width: none; }
}

/* ============================================
   响应式 - 手机 (<= 520px)
   ============================================ */
@media (max-width: 520px) {
    /* 导航栏 */
    .top-bar {
        flex-wrap: wrap;
        height: auto;
        min-height: 44px;
        padding: 6px 10px;
        gap: 4px;
    }
    .top-bar .logo { gap: 6px; }
    .top-bar .logo-icon { width: 26px; height: 26px; font-size: 13px; border-radius: 6px; }
    .top-bar .logo-text { font-size: 14px; }
    .top-bar .logo-sub { display: none !important; }
    .nav-links { gap: 0; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a { padding: 5px 8px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
    .nav-links .btn-admin { margin-left: 4px; padding: 5px 8px; font-size: 11px; flex-shrink: 0; }
    .nav-links .btn-home { margin-right: 4px; padding: 5px 8px; font-size: 11px; flex-shrink: 0; }

    /* 汉堡菜单显示 */
    .hamburger-btn { display: flex; }

    .nav-controls {
        position: relative;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        margin-top: 4px;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 8px;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        z-index: 150;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        overflow-x: visible;
    }

    .nav-links.mobile-open {
        display: flex;
    }

    .nav-links a {
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 8px;
        white-space: nowrap;
    }

    .nav-links .btn-admin {
        margin-left: 0;
        width: 100%;
        text-align: center;
        padding: 10px 12px;
        font-size: 14px;
    }

    .nav-links .btn-home {
        margin-right: 0;
        width: 100%;
        text-align: center;
        padding: 10px 12px;
        font-size: 14px;
    }

    .nav-links select {
        width: 100%;
    }

    #search-box {
        width: 100%;
    }

    #search-input {
        width: 100%;
        padding: 10px 12px 10px 36px;
        font-size: 14px;
    }

    #search-input:focus {
        width: 100%;
    }

    .search-icon {
        left: 10px;
        top: 50%;
        width: 16px;
        height: 16px;
    }

    .season-select { min-width: 100%; font-size: 14px; padding: 10px 12px; }

    /* 主内容 */
    .main-content { padding: 10px; }

    /* 页面标题 */
    .page-header { margin-bottom: 16px; }
    .page-header h1 { font-size: 18px; }
    .page-header p { font-size: 12px; }

    /* Tab */
    .tab-bar { gap: 2px; margin-bottom: 12px; }
    .tab-btn { padding: 6px 12px; font-size: 13px; }

    /* 统计卡片 */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px; border-radius: 8px; }
    .stat-card .stat-value { font-size: 24px; }
    .stat-card .stat-label { font-size: 11px; }

    /* 表格 - 水平滚动 */
    .card { border-radius: 8px; }
    .card-header { padding: 10px 14px; font-size: 13px; }
    .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { font-size: 13px; min-width: 560px; }
    thead th { padding: 8px 10px; font-size: 11px; }
    tbody td { padding: 8px 10px; }
    .win-rate-bar { min-width: 70px; gap: 4px; }
    .win-rate-bar .bar-text { font-size: 11px; min-width: 36px; }
    .tier-badge { font-size: 10px; padding: 1px 6px; }

    /* 排序提示 */
    .sortable-hint { display: none; }

    /* 筛选栏 */
    .filter-bar { gap: 6px; margin-bottom: 12px; }
    .filter-bar select, .filter-bar input { font-size: 12px; padding: 6px 10px; min-width: 0; }

    /* 对局记录卡片 */
    .game-card { padding: 10px 12px; margin-bottom: 8px; border-radius: 8px; }
    .game-card .game-top { margin-bottom: 6px; }
    .game-card .game-code { font-size: 13px; }
    .game-card .game-mode { font-size: 12px; }
    .game-card .game-winner { font-size: 12px; }
    .game-card .game-player-tag { font-size: 11px; padding: 2px 6px; }

    /* 玩家详情页 */
    .player-header { flex-direction: column; gap: 12px; margin-bottom: 16px; }
    .player-avatar { width: 60px; height: 60px; font-size: 28px; border-radius: 12px; }
    .player-info h1 { font-size: 20px; }
    .player-info .player-meta { gap: 8px; font-size: 12px; flex-wrap: wrap; }
    .player-rating-big { font-size: 32px; }
    .chart-container { height: 180px; padding: 10px; margin-bottom: 16px; border-radius: 8px; }

    /* 两栏 */
    .grid-2 { grid-template-columns: 1fr; gap: 12px; }

    /* 表单 */
    .form-group { margin-bottom: 12px; }
    .form-group label { font-size: 12px; }
    .form-group select, .form-group input { font-size: 14px; padding: 8px 10px; }

    /* 按钮 */
    .btn { padding: 7px 14px; font-size: 13px; }
    .btn-primary { padding: 8px 16px; }

    /* 弹窗 */
    .modal { padding: 20px; border-radius: 12px; }
    .modal h2 { font-size: 18px; margin-bottom: 16px; }
    .modal input { font-size: 16px; padding: 10px 12px; margin-bottom: 12px; }

    /* Toast */
    .toast { top: 10px; right: 10px; left: 10px; font-size: 13px; padding: 10px 14px; border-radius: 8px; }

    /* 加载更多 */
    .load-more-btn { padding: 10px 24px; font-size: 14px; }

    /* 分页 */
    .pagination button { padding: 6px 10px; font-size: 12px; }

    /* 流程时间线 */
    .flow-text { font-size: 12px; }
    .flow-label { font-size: 11px; }
    .flow-item { margin-bottom: 8px; padding-left: 14px; }

    /* 身份排名卡片 */
    .role-card { border-radius: 8px; }
}

/* ============================================
   响应式 - 超小屏 (<= 360px)
   ============================================ */
@media (max-width: 360px) {
    .main-content { padding: 8px; }
    .page-header h1 { font-size: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card { padding: 10px; }
    .stat-card .stat-value { font-size: 20px; }
    .tab-btn { padding: 5px 10px; font-size: 12px; }
    .game-card .game-player-tag { font-size: 10px; padding: 1px 5px; }
    .player-avatar { width: 50px; height: 50px; font-size: 24px; }
    .player-info h1 { font-size: 18px; }
    .player-rating-big { font-size: 28px; }
    .chart-container { height: 150px; }
}

/* 加载更多按钮 */
.load-more-container {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
}

.load-more-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 主页按钮样式 */
.btn-home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    margin-right: 8px;
}

.btn-home:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-home:active {
    transform: translateY(0);
}

/* 赛季选择器样式 */
.season-select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #2a3550;
    border-radius: 8px;
    padding: 6px 12px;
    color: #94a3b8;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.season-select:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.season-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.season-select option {
    background: #1e293b;
    color: #e2e8f0;
    padding: 8px;
}

/* 周筛选器 - 与赛季筛选器风格一致 */
.week-select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #2a3550;
    border-radius: 8px;
    padding: 6px 12px;
    color: #94a3b8;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.week-select:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.week-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.week-select option {
    background: #1e293b;
    color: #e2e8f0;
    padding: 8px;
}


/* ============================================ */
/* 对局详情 - 游戏流程时间线 */
/* ============================================ */
.flow-section {
    margin-top: 4px;
}

.flow-timeline {
    position: relative;
    padding-left: 20px;
}

.flow-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.flow-item {
    position: relative;
    margin-bottom: 12px;
    padding-left: 16px;
}

.flow-dot {
    position: absolute;
    left: -17px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--bg-card);
    z-index: 1;
}

.flow-night .flow-dot { background: #6366f1; box-shadow: 0 0 6px rgba(99, 102, 241, 0.4); }
.flow-day .flow-dot { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.flow-police .flow-dot { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.4); }
.flow-retire .flow-dot { background: #8b5cf6; box-shadow: 0 0 6px rgba(139, 92, 246, 0.4); }
.flow-sheriff .flow-dot { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.flow-remaining .flow-dot { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); width: 12px; height: 12px; left: -18px; top: 5px; }

.flow-label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.flow-night .flow-label { color: #a5b4fc; }
.flow-day .flow-label { color: #fcd34d; }
.flow-police .flow-label { color: #93c5fd; }
.flow-retire .flow-label { color: #c4b5fd; }
.flow-sheriff .flow-label { color: #6ee7b7; }
.flow-remaining .flow-label { color: #fca5a5; }

.flow-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
    word-break: break-all;
}

/* 对局卡片上标记含流程 */
.game-card .has-flow-badge {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}


/* ============ 身份排名页面 ============ */
.role-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.15s;
}

.role-card:hover {
    border-color: rgba(96, 165, 250, 0.25);
}

.role-card .role-header:hover {
    background: var(--bg-card-hover);
}

.role-card .role-arrow {
    transition: transform 0.25s ease;
}

.role-card[open] .role-arrow,
.role-card .role-arrow.rotated {
    transform: rotate(180deg);
}
