/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF9500;
    --secondary-color: #007AFF;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --danger-color: #FF3B30;
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-primary: #1C1C1E;
    --text-secondary: #8E8E93;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

html, body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: #F8F9FB;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 80px;
}

/* ==================== 页面容器 ==================== */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ==================== 头部区域 ==================== */
.header {
    background: #FFFFFF;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E5E7;
}

.page-title {
    color: white;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
}

.back-today-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.back-today-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

.date-display {
    text-align: center;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    position: relative;
}

.cloud-decoration {
    font-size: 24px;
    margin-left: 10px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* 吉祥物 - 隐藏 */
.mascot-container {
    display: none;
}

.mascot {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.mascot-face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.mascot-eyes {
    display: flex;
    gap: 12px;
}

.eye {
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
    animation: blink 3s ease-in-out infinite;
}

@keyframes blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

.mascot-mouth {
    font-size: 14px;
    color: #333;
}

.mascot-bubble {
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* 进度条 - 隐藏 */
.progress-container {
    display: none;
}

.progress-bar {
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 50%, #FF6347 100%);
    border-radius: 15px;
    transition: width 0.5s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-fill .stars {
    display: flex;
    gap: 5px;
    color: white;
    font-size: 14px;
    animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-text {
    text-align: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.progress-text .completed {
    font-size: 24px;
    color: #FFD700;
}

.progress-text .total {
    font-size: 18px;
}

.progress-text .label {
    margin-left: 5px;
}

/* ==================== 分类标签 - 隐藏 ==================== */
.category-tabs {
    display: none;
}

.tab {
    padding: 10px 20px;
    background: white;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.05);
}

.tab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* ==================== 任务列表 ==================== */
.task-list {
    padding: 10px 20px 20px;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 20px;
}

.task-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border-left: 4px solid var(--secondary-color);
    position: relative;
    overflow: hidden;
}

.task-card.study {
    border-left-color: #007AFF;
}

.task-card.english {
    border-left-color: #9B59B6;
}

.task-card.sports {
    border-left-color: #FF9500;
}

.task-card.other {
    border-left-color: #34C759;
}

.task-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.task-card.completed {
    opacity: 0.7;
}

.task-card.completed .task-title {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.link-hint {
    color: #9B59B6;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 500;
}

.task-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.task-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.task-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.task-meta .duration {
    font-size: 12px;
    color: var(--text-secondary);
    background: #F5F7FA;
    padding: 4px 10px;
    border-radius: 12px;
}

.check-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #E5E5E7;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.check-btn:hover {
    transform: scale(1.1);
}

.check-btn.checked {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
    border-color: #30D158;
    animation: checkmark 0.5s ease;
}

@keyframes checkmark {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.check-icon {
    font-size: 24px;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.check-btn.checked .check-icon {
    opacity: 1;
    transform: scale(1);
}

/* ==================== 连续打卡卡片 ==================== */
.streak-card {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    animation: slideUp 0.5s ease;
}

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

.streak-icon {
    font-size: 48px;
    animation: flame 1s ease-in-out infinite;
}

@keyframes flame {
    0%, 100% { transform: scale(1) rotate(-3deg); }
    50% { transform: scale(1.1) rotate(3deg); }
}

.streak-number {
    font-size: 48px;
    font-weight: 800;
    color: white;
}

.streak-label {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== 日历 ==================== */
.calendar-section {
    background: white;
    margin: 20px;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-nav-btn {
    background: #F5F7FA;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.calendar-nav-btn:hover {
    background: #E5E5E7;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.calendar {
    background: #F5F7FA;
    border-radius: var(--radius-md);
    padding: 15px;
}

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

.weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px;
}

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

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.calendar-day:hover {
    transform: scale(1.1);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-day.success {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
    color: white;
}

.calendar-day.partial {
    background: linear-gradient(135deg, #FF9500 0%, #FF6B00 100%);
    color: white;
}

.calendar-day.empty {
    background: transparent;
    cursor: default;
}

.calendar-day.empty:hover {
    transform: none;
}

.status-icon {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 8px;
}

.calendar-legend {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-color.success {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
}

.legend-color.partial {
    background: linear-gradient(135deg, #FF9500 0%, #FF6B00 100%);
}

.legend-color.none {
    background: #E5E5E7;
}

/* ==================== 统计卡片 ==================== */
.stats-section {
    background: white;
    margin: 20px;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 32px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: white;
    margin-bottom: 3px;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== 成就墙 ==================== */
.achievements-section {
    background: white;
    margin: 20px;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.achievement-badge {
    background: #F5F7FA;
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    opacity: 0.5;
    filter: grayscale(100%);
    transition: all 0.3s ease;
}

.achievement-badge.earned {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    opacity: 1;
    filter: grayscale(0%);
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(255, 165, 0, 0.6); }
}

.badge-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.badge-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== 任务配置 ==================== */
.add-task-btn {
    background: white;
    color: #667eea;
    padding: 12px 24px;
    border-radius: 25px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    margin-top: 10px;
}

.add-task-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.plus-icon {
    font-size: 20px;
    font-weight: 700;
}

.config-task-list {
    max-width: 600px;
    margin: 0 auto;
}

.config-section {
    margin-bottom: 30px;
}

.config-section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-left: 20px;
    color: var(--text-primary);
}

.config-task-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.config-task-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-hover);
}

.config-task-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.config-task-schedule {
    font-size: 12px;
    color: var(--text-secondary);
}

.config-task-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F5F7FA;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: scale(1.1);
    background: #E5E5E7;
}

.action-btn.delete:hover {
    background: #FFE5E5;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* ==================== 弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #E5E5E7;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #E5E5E7;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.custom-days-select {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.custom-days-select label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: normal;
    color: var(--text-primary);
    cursor: pointer;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #E5E5E7;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #F5F7FA;
    color: var(--text-primary);
}

/* ==================== 历史链接按钮 ==================== */
.history-link {
    display: flex;
    justify-content: center;
    padding: 15px 20px 100px;
    margin-top: 10px;
}

.history-btn {
    background: white;
    color: #667eea;
    padding: 12px 24px;
    border-radius: 25px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ==================== 庆祝动画 ==================== */
.celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    text-align: center;
}

.celebration.hidden {
    display: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: confettiFall 1s ease-out forwards;
}

.confetti:nth-child(1) {
    background: #FF6B6B;
    left: -50px;
    top: -50px;
    animation-delay: 0s;
}

.confetti:nth-child(2) {
    background: #4ECDC4;
    left: 50px;
    top: -50px;
    animation-delay: 0.1s;
}

.confetti:nth-child(3) {
    background: #FFE66D;
    left: -50px;
    top: 50px;
    animation-delay: 0.2s;
}

.confetti:nth-child(4) {
    background: #95E1D3;
    left: 50px;
    top: 50px;
    animation-delay: 0.3s;
}

.confetti:nth-child(5) {
    background: #F38181;
    left: 0;
    top: -80px;
    animation-delay: 0.4s;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100px) rotate(720deg);
        opacity: 0;
    }
}

.celebration-text {
    font-size: 32px;
    font-weight: 800;
    color: #FF9500;
    text-shadow: 0 2px 10px rgba(255, 149, 0, 0.3);
    animation: celebrationPulse 0.5s ease;
}

@keyframes celebrationPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ==================== 底部导航 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 10px 20px;
    padding-bottom: env(safe-area-inset-bottom, 10px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    z-index: 100;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-icon {
    font-size: 24px;
}

.nav-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.nav-btn.active .nav-text {
    color: #667eea;
}

.nav-btn.active .nav-icon {
    transform: scale(1.1);
}

.nav-btn:active {
    transform: scale(0.95);
}

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

/* ==================== 响应式 ==================== */
@media (max-width: 480px) {
    .task-card {
        padding: 12px;
    }

    .task-icon {
        font-size: 28px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

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

/* ==================== iPad 横屏优化 ==================== */
@media (min-width: 768px) and (orientation: landscape) {
    .history-link {
        bottom: 20px;
    }
}
