:root {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #f3f4f6;
    --log-bg: #0d1117;
    --log-text: #c9d1d9;
    --log-border: #21262d;
    --up-color: #4ade80;
    --down-color: #f87171;
    --score-color: #fbbf24;
    --new-color: #60a5fa;
    --out-color: #9ca3af;
    --time-color: #8b949e;
    --panel-height: 95vh;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #e8ecf1;
    margin: 0;
    padding: 20px;
    min-height: 95vh;
}

.main-layout {
    display: flex;
    gap: 20px;
    max-width: 1550px;
    margin: 0 auto;
    align-items: flex-start;
}

/* 左侧主内容区 */
.left-col {
    flex: 1 1 680px;
    min-width: 0;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: var(--panel-height);
}

.left-col h1 {
    font-size: 22px;
    margin: 0 0 20px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.rank-table-container {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}

th {
    color: #6b7280;
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 2;
    box-shadow: 0 1px 0 #f3f4f6;
}

td {
    font-size: 14px;
    color: #374151;
}

.rank { font-weight: 600; }
.rank-1 { color: #f59e0b; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #b45309; }

.empty {
    text-align: center;
    color: #9ca3af;
    padding: 30px;
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    color: #6b7280;
    font-size: 13px;
    flex-shrink: 0;
}

.dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* 右侧面板 */
.right-col {
    flex: 0 0 900px;
    width: 900px;
    background: transparent;
    border-radius: 18px;
    display: flex;
    gap: 12px;
    height: var(--panel-height);
    overflow: hidden;
    position: sticky;
    top: 20px;
}

.log-section, .monitor-section {
    flex: 1 1 50%;
    min-width: 0;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.log-header, .monitor-header {
    padding: 0 10px;
    height: 44px;
    border-bottom: 1px solid #21262d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #161b22;
}

.log-header .title, .monitor-header .title {
    color: #e6edf3;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.log-header .badge {
    background: #238636;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
    min-width: 16px;
    text-align: center;
    transition: all 0.3s;
}

.log-header .badge.zero {
    background: #30363d;
    color: #8b949e;
}

.log-header .badge.has-change {
    animation: badgePulse 0.6s ease-out;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.25); background: #2ea043; }
}

.log-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 0;
    min-height: 0;
}

/* ===== 关键修改：上下区域平分空间，独立滚动 ===== */
.monitor-targets,
.monitor-changes {
    flex: 1 1 0;          /* 各占剩余空间的一半 */
    overflow-y: auto;     /* 内容超出时显示滚动条 */
    padding: 6px 0;
    min-height: 0;        /* 防止内容撑开 */
}

.monitor-targets {
    border-bottom: 1px solid #21262d;
}

/* 滚动条样式统一 */
.log-list::-webkit-scrollbar,
.monitor-targets::-webkit-scrollbar,
.monitor-changes::-webkit-scrollbar {
    width: 3px;
}
.log-list::-webkit-scrollbar-track,
.monitor-targets::-webkit-scrollbar-track,
.monitor-changes::-webkit-scrollbar-track {
    background: transparent;
}
.log-list::-webkit-scrollbar-thumb,
.monitor-targets::-webkit-scrollbar-thumb,
.monitor-changes::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

.log-empty, .monitor-empty {
    color: #484f58;
    text-align: center;
    padding: 20px 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    height: 100%;
}

.log-item {
    padding: 8px 10px;
    border-bottom: 1px solid #161b22;
    font-size: 13px;
    line-height: 1.4;
    color: #c9d1d9;
    animation: fadeSlideIn 0.3s ease-out;
    word-break: break-all;
}

.log-item:first-child {
    animation: highlightNew 1s ease-out;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-8px); max-height: 0; }
    to { opacity: 1; transform: translateY(0); max-height: 60px; }
}

@keyframes highlightNew {
    0% { background: #1a3a2a; }
    100% { background: transparent; }
}

.log-item .log-time {
    color: #8b949e;
    font-size: 12px;
    margin-right: 4px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    white-space: nowrap;
}

.log-item .log-name { font-weight: 600; color: #e6edf3; }
.log-item .log-up { color: #4ade80; font-weight: 500; }
.log-item .log-down { color: #f87171; font-weight: 500; }
.log-item .log-score { color: #fbbf24; }
.log-item .log-new { color: #60a5fa; font-weight: 500; }
.log-item .log-out { color: #9ca3af; font-weight: 500; }
.log-item .log-detail { color: #8b949e; font-size: 12px; }

.log-footer {
    padding: 8px 10px;
    border-top: 1px solid #21262d;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #161b22;
    font-size: 12px;
}

.log-footer .count { color: #8b949e; }

.btn-clear {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 0 8px;
    height: 24px;
    line-height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-clear:hover {
    background: #30363d;
    border-color: #484f58;
    color: #e6edf3;
}

.monitor-input-area {
    display: flex;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.monitor-input-area input {
    flex: 1;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 0 8px;
    height: 28px;
    line-height: 28px;
    color: #c9d1d9;
    font-size: 11px;
    outline: none;
    min-width: 0;
}

.monitor-input-area input:focus {
    border-color: #58a6ff;
}

.monitor-input-area button {
    background: #238636;
    border: none;
    color: white;
    padding: 0 10px;
    height: 28px;
    line-height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
}

.monitor-item {
    padding: 8px 10px;
    border-bottom: 1px solid #161b22;
    font-size: 13px;
    color: #c9d1d9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.btn-remove {
    background: none;
    border: none;
    color: #f87171;
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-remove:hover { opacity: 1; }

/* 响应式 */
@media (max-width: 1524px) {
    .main-layout {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        max-width: 100%;
    }
    .left-col {
        flex: 1 1 auto;
        width: 100%;
        height: auto;
        position: static;
        border-radius: 16px;
        max-height: 70vh;
        min-height: 400px;
    }
    .right-col {
        flex: 1 1 auto;
        width: 100%;
        height: auto;
        position: static;
        flex-direction: column;
        gap: 12px;
        max-height: 80vh;
        min-height: 500px;
    }
    .log-section, .monitor-section {
        flex: 1 1 auto;
        min-height: 200px;
    }
    :root { --panel-height: auto; }
}

@media (max-width: 768px) {
    body { padding: 12px; }
    .left-col { padding: 16px; border-radius: 14px; max-height: 65vh; }
    .right-col { border-radius: 14px; }
    th, td { padding: 10px 6px; font-size: 12px; }
    th { font-size: 11px; }
}

@media (max-width: 480px) {
    body { padding: 8px; }
    .left-col { padding: 12px; border-radius: 12px; max-height: 70vh; }
    .right-col { border-radius: 12px; max-height: 80vh; min-height: 450px; }
    table { min-width: 480px; }
    .rank-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    h1 { font-size: 18px; }
    .footer { font-size: 11px; }
}