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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #667eea;
    font-size: 28px;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 14px;
}

nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.nav-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
}

.nav-btn.active {
    color: #667eea;
    border-bottom: 3px solid #667eea;
    font-weight: 600;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.date-header h2 {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
}

.habits-list h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

.habit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 15px;
}

.habit-item.checked {
    background: #e8f5e9;
}

.habit-info h4 {
    color: #333;
    font-size: 16px;
    margin-bottom: 5px;
}

.streak {
    color: #666;
    font-size: 14px;
}

.checkin-btn {
    padding: 10px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.checkin-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.checkin-btn.checked {
    background: #4caf50;
}

.stats {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
}

.stat-label {
    color: #666;
}

.stat-value {
    color: #667eea;
    font-weight: 600;
}

.goal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.goal-form label {
    color: #333;
    font-weight: 600;
}

.goal-types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.type-btn {
    padding: 12px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.type-btn:hover, .type-btn.active {
    border-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
}

textarea {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

input[type="email"],
input[type="text"] {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.primary-btn {
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.primary-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.ai-suggestion {
    padding: 20px;
    background: #f0f4ff;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.ai-suggestion h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.ai-suggestion ul {
    margin: 15px 0;
    padding-left: 20px;
}

.ai-suggestion li {
    margin: 8px 0;
    color: #333;
}

.progress-item {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.progress-item h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

.progress-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.5s;
}

.progress-text {
    color: #666;
    font-size: 14px;
}

.calendar {
    margin-top: 20px;
}

.calendar-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    background: #f0f0f0;
    color: #999;
}

.day.checked {
    background: #4caf50;
    color: white;
    font-size: 18px;
}

.day.missed {
    background: #f44336;
    color: white;
    font-size: 18px;
}

.day.empty {
    background: transparent;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

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

.modal-content h2 {
    color: #667eea;
    font-size: 32px;
    margin-bottom: 20px;
}

.modal-content p {
    color: #333;
    font-size: 18px;
    margin-bottom: 30px;
    line-height: 1.6;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .goal-types {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 设定目标页面新增样式 */
.goal-intro {
    text-align: center;
    margin-bottom: 30px;
}

.intro-text {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
}

.goal-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.option-card {
    background: white;
    border: 2px solid #e0e7ff;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.option-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
    transform: translateY(-5px);
}

.option-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.option-card h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.option-card p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.option-card ul {
    text-align: left;
    margin: 15px 0;
    padding-left: 20px;
}

.option-card ul li {
    color: #555;
    margin: 8px 0;
    font-size: 14px;
}

.secondary-btn {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: #f0f4ff;
}

.current-goal {
    margin-top: 30px;
    padding: 20px;
    background: #f0f4ff;
    border-radius: 15px;
}

.goal-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 15px;
}

.goal-card h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 18px;
}

.goal-card p {
    margin: 10px 0;
    color: #555;
    line-height: 1.6;
}

.goal-card strong {
    color: #333;
    margin-right: 5px;
}

.no-goal-message {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-goal-message p {
    font-size: 18px;
    margin: 10px 0;
}

.no-goal-message p:first-child {
    font-size: 24px;
    color: #667eea;
    font-weight: 600;
}

/* 进度概览样式 */
.progress-overview {
    margin-bottom: 30px;
}

.progress-overview h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.overview-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.card-icon {
    font-size: 36px;
}

.card-content {
    flex: 1;
}

.card-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.card-value {
    font-size: 24px;
    font-weight: 600;
}

.goal-description {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* 表单样式优化 */
.form-intro {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: -5px 0 25px 0;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    color: #667eea;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 12px;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-hint {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    line-height: 1.4;
}

.habit-item-group {
    margin-bottom: 15px;
}

.habit-item-group:last-child {
    margin-bottom: 0;
}

.habit-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.form-actions .primary-btn,
.form-actions .secondary-btn {
    flex: 1;
}

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

/* 统一日历样式 */
.unified-calendar {
    margin-top: 30px;
    padding: 25px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.unified-calendar h3 {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.goal-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

/* 日历单元格内的目标徽章 */
.day {
    position: relative;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4px;
}

.day.checked {
    background: #e8f5e9;
}

/* 根据打卡数量调整颜色深浅 */
.day.checked.level-1 { background: #e8f5e9; }
.day.checked.level-2 { background: #c8e6c9; }
.day.checked.level-3 { background: #a5d6a7; }
.day.checked.level-4 { background: #81c784; }
.day.checked.level-5 { background: #66bb6a; }

.day-number {
    font-size: 12px;
    color: #333;
    margin-bottom: 2px;
}

.goal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
}

.goal-badges .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
}

/* 目标列表样式 */
.goals-list {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.goals-list h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 20px;
}

.goal-summary {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
}

.goal-summary-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.goal-summary-header h4 {
    color: #333;
    font-size: 16px;
    margin: 0;
}

.goal-stats {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.goal-stats span {
    display: inline-block;
}
