* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.controls {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.date-selector, .weight-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-selector label, .weight-input label {
    font-weight: bold;
    color: #555;
}

#month-select, #weight {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#month-select:focus, #weight:focus {
    outline: none;
    border-color: #667eea;
}

#save-weight {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#save-weight:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.calendar-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 15px;
}

.day-header {
    text-align: center;
    font-weight: bold;
    color: #667eea;
    padding: 10px;
    background: #f8f9ff;
    border-radius: 8px;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    min-height: 80px;
}

.calendar-day:hover {
    background: #f8f9ff;
    border-color: #667eea;
}

.calendar-day.other-month {
    color: #ccc;
    background: #fafafa;
}

.calendar-day.today {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    font-weight: bold;
}

.calendar-day.has-weight {
    background: #e8f5e8;
    border-color: #4caf50;
}

.calendar-day.has-weight.today {
    background: linear-gradient(45deg, #4caf50, #45a049);
}

.day-number {
    font-size: 16px;
    font-weight: bold;
}

.day-weight {
    font-size: 12px;
    margin-top: 5px;
    color: #666;
}

.calendar-day.today .day-weight {
    color: rgba(255,255,255,0.9);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.stat-card h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item span:last-child {
    font-weight: bold;
    color: #333;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.chart-container h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.3em;
}

#weight-chart {
    max-width: 100%;
    height: auto;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    header p {
        font-size: 1em;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 15px;
    }
    
    .date-selector, .weight-input {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .date-selector label, .weight-input label {
        font-size: 16px;
        min-width: 120px;
    }
    
    #month-select, #weight {
        font-size: 18px;
        padding: 15px;
        min-height: 50px;
    }
    
    #save-weight {
        font-size: 18px;
        padding: 15px 30px;
        min-height: 50px;
        width: 100%;
    }
    
    .calendar-container {
        padding: 15px;
    }
    
    .calendar-day {
        min-height: 70px;
        padding: 5px;
    }
    
    .day-number {
        font-size: 16px;
    }
    
    .day-weight {
        font-size: 12px;
        margin-top: 3px;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-item {
        font-size: 16px;
        padding: 12px 0;
    }
    
    .chart-container {
        padding: 15px;
    }
    
    #weight-chart {
        width: 100%;
        height: 250px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .controls {
        padding: 15px;
    }
    
    .calendar-day {
        min-height: 60px;
    }
    
    .day-number {
        font-size: 14px;
    }
    
    .day-weight {
        font-size: 10px;
    }
    
    .stat-item {
        font-size: 14px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calendar-day {
    animation: fadeIn 0.3s ease-out;
}

/* 成功提示样式 */
.success-message {
    background: #4caf50;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

/* 错误提示样式 */
.error-message {
    background: #f44336;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}
