* {
    box-sizing: border-box;
}

#calendar {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    border-radius: 16px;
    padding: 15px;
}

h2 {
    margin: 0 0 20px 0;
    color: var(--text-color);
    font-size: 18px;
}

.contribution-chart {
    width: 100%;
    background: var(--chart-bg);
}

.content {
    overflow-x: auto;
}

table {
    border-spacing: 3px;
    width: 100%;
    white-space: nowrap;
}

th, td {
    background-color: transparent;
    width: 14px;
    height: 14px;
    line-height: 1;
    padding: 0;
    font-size: 12px;
    cursor: pointer;
}

th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 400;
    padding-bottom: 6px;
}

tr {
    font-weight: 300;
    height: 14px;
}

#first-block {
    width: 32px;
}

.block {
    border-radius: 3px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.block:hover {
    stroke: var(--hover-stroke);
    stroke-width: 1.5px;
    transform: scale(1.1);
}

.block.hidden {
    background-color: transparent !important;
    cursor: default;
}

.block.hidden:hover {
    transform: none;
    stroke: none;
}

/* 星期标签 */
.tbody .label {
    color: var(--text-secondary);
    font-size: 11px;
    text-align: left;
    padding-right: 8px;
}

/* 月份标签 */
.thead .label {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 11px;
}

/* 颜色说明区 */
.colors {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-secondary);
}

.color-item {
    width: 12px;
    height: 12px;
    display: inline-block;
    border-radius: 3px;
}

.more-text {
    margin-left: 6px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* 错误状态 */
.error {
    text-align: center;
    padding: 40px;
    color: #d73a49;
    font-size: 14px;
}

/* 浮层样式 */
.tooltip {
    position: fixed;
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ========== 深浅模式变量 ========== */
:root {
    --bg-color: #ffffff;
    --chart-bg: #ffffff;
    --text-color: #1f2328;
    --text-secondary: #57606a;
    --hover-stroke: #1f2328;
    --tooltip-bg: #1f2328;
    --tooltip-text: #ffffff;
}

/* 深色模式 */
[data-theme="dark"] {
    --bg-color: #0d1117;
    --chart-bg: #0d1117;
    --text-color: #e6edf3;
    --text-secondary: #8d96a0;
    --hover-stroke: #ffffff;
    --tooltip-bg: #e6edf3;
    --tooltip-text: #0d1117;
}

/* ========== 响应式适配 ========== */

/* 平板 */
@media (max-width: 768px) {
    .github-calendar-container {
        padding: 16px;
        border-radius: 12px;
    }
    
    th, td {
        width: 12px;
        height: 12px;
    }
    
    #first-block {
        width: 30px;
    }
}

/* 手机 (小屏) */
@media (max-width: 550px) {
    .github-calendar-container {
        padding: 12px;
        border-radius: 10px;
    }
    
    /* 格子大小 - 小屏稍微缩小但保持可点 */
    th, td {
        width: 10px;
        height: 10px;
    }
    
    /* 格子间距减小 */
    table {
        border-spacing: 2px;
    }
    
    #first-block {
        width: 28px;
    }
    
    .tbody .label {
        font-size: 10px;
        padding-right: 4px;
    }
    
    .thead .label {
        font-size: 10px;
    }
    
    .colors {
        margin-top: 12px;
        font-size: 10px;
    }
    
    .color-item {
        width: 10px;
        height: 10px;
    }
    
    .more-text {
        margin-left: 4px;
    }
}

/* 极小屏 (宽度不足 400px) */
@media (max-width: 400px) {
    .github-calendar-container {
        padding: 8px;
        border-radius: 8px;
    }
    
    /* 格子再缩小一点 */
    th, td {
        width: 8px;
        height: 8px;
    }
    
    table {
        border-spacing: 2px;
    }
    
    #first-block {
        width: 24px;
    }
    
    .tbody .label {
        font-size: 9px;
        padding-right: 3px;
    }
    
    /* 小屏时隐藏月份行，节省空间 */
    .thead {
        display: none;
    }
    
    .colors {
        margin-top: 10px;
    }
}

/* 当隐藏月份行时，调整表格顶部边距 */
@media (max-width: 400px) {
    table {
        margin-top: 4px;
    }
}