:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --timeline-line: #334155;
    
    /* Heatmap Colors */
    --heat-0: rgba(255,255,255,0.05);
    --heat-1: #1e3a8a;
    --heat-2: #3b82f6;
    --heat-3: #60a5fa;
    --heat-4: #93c5fd;

    /* Typography System */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-md: 1.125rem;
    --font-size-lg: 1.5rem;
    --font-size-xl: 2.25rem;
    --font-size-2xl: 3.5rem;
    --font-size-hero: 4rem;
}

@media (max-width: 768px) {
    :root {
        --font-size-xs: 0.7rem;
        --font-size-sm: 0.8rem;
        --font-size-base: 0.9375rem;
        --font-size-md: 1.05rem;
        --font-size-lg: 1.25rem;
        --font-size-xl: 1.8rem;
        --font-size-2xl: 2.2rem;
        --font-size-hero: 3rem;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-xl: 1.5rem;
        --font-size-2xl: 1.8rem;
    }
}

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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Header */
header {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    background: radial-gradient(circle at top right, #1e1b4b, transparent 40%),
                radial-gradient(circle at bottom left, #1e293b, transparent 40%);
}

h1 {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    animation: fadeUp 1s ease forwards 0.2s;
}

.subtitle {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    max-width: 600px;
    opacity: 0;
    animation: fadeUp 1s ease forwards 0.4s;
}

/* Language Toggle */
.lang-toggle {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--timeline-line);
    padding: 0.5rem;
    border-radius: 2rem;
    display: flex;
    gap: 0.5rem;
    cursor: pointer;
    z-index: 100;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border-radius: 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

/* --- Stats Section --- */
.stats-container {
    max-width: 1000px;
    margin: -6rem auto 4rem; /* Lifted higher for better integration */
    padding: 0 2rem;
    position: relative;
    z-index: 5;
    opacity: 0;
    animation: fadeUp 1s ease forwards 0.6s;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.section-title::before, .section-title::after {
    content: '';
    height: 1px;
    width: 60px;
    background: linear-gradient(to right, transparent, var(--timeline-line));
}

.section-title::after {
    background: linear-gradient(to left, transparent, var(--timeline-line));
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2.5rem 1.5rem;
    border-radius: 1.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.1), transparent);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent);
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}

.stat-value {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.05rem;
    background: linear-gradient(to bottom, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: var(--accent);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    margin-top: 0.5rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

.chart-box {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.chart-box.full-width {
    grid-column: 1 / -1;
}

.chart-box h3 {
    margin-bottom: 2rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-box h3::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
}

/* --- Heatmap Calendar --- */
.heatmap-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 5px 0;
    margin: 0 -5px;
}

.calendar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: max-content;
}

.months-row {
    display: grid;
    gap: 4px;
    height: 1.5rem;
    align-items: end;
    min-width: max-content;
}

.month-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}

.days-grid {
    display: grid;
    grid-template-rows: repeat(7, 12px);
    gap: 4px;
    min-width: max-content;
}

.heat-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background-color: var(--heat-0);
    transition: transform 0.2s;
}

.heat-box:hover {
    transform: scale(1.5);
    z-index: 10;
    position: relative;
    border: 1px solid #fff;
}

.heat-box.empty {
    visibility: hidden;
}

.intensity-0 { background-color: var(--heat-0); }
.intensity-1 { background-color: var(--heat-1); }
.intensity-2 { background-color: var(--heat-2); }
.intensity-3 { background-color: var(--heat-3); }
.intensity-4 { background-color: var(--heat-4); }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    justify-content: flex-end;
}

/* Weekday/work-rhythm visuals removed to keep dashboard focused */

/* Time Chart */
.time-bar-group {
    margin-bottom: 1rem;
}

.time-label {
    font-size: var(--font-size-sm);
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.time-track {
    background: rgba(255,255,255,0.05);
    height: 24px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.time-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 12px;
}

.time-val {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-xs);
    font-weight: bold;
    color: white;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}


/* --- Timeline --- */
.timeline-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 4rem 2rem;
    position: relative;
}

/* Vertical Line */
.timeline-container::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: var(--timeline-line);
    top: 0;
    z-index: 0;
}

/* Timeline Item */
.timeline-item {
    display: flex;
    justify-content: center;
    padding-bottom: 6rem;
    position: relative;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-content {
    width: 45%;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

.timeline-content:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 20px 40px -10px var(--accent-glow);
}

/* Alternating Layout */
.timeline-item:nth-child(odd) {
    justify-content: flex-start;
}

.timeline-item:nth-child(even) {
    justify-content: flex-end;
}

/* Connecting Dots */
.timeline-icon {
    position: absolute;
    left: 50%;
    top: 2rem;
    transform: translateX(-50%);
    width: 3rem;
    height: 3rem;
    background: var(--bg-color);
    border: 2px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    z-index: 10;
    box-shadow: 0 0 0 8px var(--bg-color);
}

/* Typography & Tags */
.date {
    font-size: var(--font-size-sm);
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: block;
}

.chapter-title {
    font-size: var(--font-size-lg);
    margin-bottom: 1rem;
    font-weight: 700;
}

.tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.tag {
    font-size: var(--font-size-xs);
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--timeline-line);
    margin-top: 4rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    h1 { 
        padding: 0 1rem;
        word-wrap: break-word;
    }
    
    .subtitle {
        padding: 0 1.5rem;
        word-wrap: break-word;
    }

    .stats-container {
        margin-top: -3rem;
        padding: 0 1rem;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow: hidden;
    }

    .section-title {
        margin-bottom: 2rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 2rem 1rem;
    }

    .timeline-container {
        padding: 2rem 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .timeline-container::before {
        left: 20px;
    }
    
    .timeline-item {
        justify-content: flex-end !important;
        padding-left: 45px;
        padding-bottom: 4rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .timeline-content {
        width: 100%;
        padding: 1.5rem;
        box-sizing: border-box;
    }
    
    .timeline-icon {
        left: 20px;
        width: 2.2rem;
        height: 2.2rem;
    }

    /* Stats Mobile */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .lang-toggle {
        top: 1rem;
        right: 1rem;
        padding: 0.3rem;
    }

    .lang-btn {
        padding: 0.4rem 0.8rem;
    }
    
    header {
        padding: 6rem 1rem 4rem;
        min-height: auto;
    }

    .heatmap-container {
        margin: 0 -1rem;
        padding: 5px 1rem;
    }

    .calendar-wrapper {
        gap: 6px;
    }

    .heat-box {
        width: 10px;
        height: 10px;
    }

    .days-grid {
        grid-template-rows: repeat(7, 10px);
        gap: 3px;
    }

    .months-row {
        gap: 3px;
        height: 1.2rem;
    }

    .heatmap-legend {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .chart-box {
        padding: 1rem;
    }

    .chart-box h3 {
        margin-bottom: 1rem;
    }

    footer {
        padding: 2rem 1rem;
    }

    .time-track {
        height: 20px;
    }

    .time-val {
        right: 8px;
    }

    .heatmap-container::after {
        content: '← 滑动查看更多 → / Swipe to see more';
        display: block;
        text-align: center;
        font-size: var(--font-size-xs);
        color: var(--text-secondary);
        margin-top: 10px;
        opacity: 0.6;
        padding: 0 1rem;
    }

    .chapter-title {
        /* font-size handled by root variable */
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

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

/* Header Actions */
.header-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.github-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.github-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    background-color: var(--text-primary);
    color: var(--bg-color);
}

[data-theme="dark"] .github-btn {
    border-color: rgba(255, 255, 255, 0.1);
}

.app-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--accent);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-sm);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.app-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    background-color: #2563eb;
}

.btn-icon {
    font-size: var(--font-size-base);
    line-height: 1;
}
