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

:root {
    --primary: #FF9F43;
    --success: #1DD1A1;
    --purple: #A55EEA;
    --pink: #FF6B81;
    --yellow: #FECA57;
    --blue: #54A0FF;
    --bg: #F8F9FA;
    --card-bg: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #FFF5EB 0%, #F0F7FF 100%);
    min-height: 100vh;
    color: var(--text);
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px;
}

.app-header {
    background-image: linear-gradient(-20deg, #00cdac 0%, #8ddad5 100%);
    background-size: 400% 400%;
    animation: gradientShift 10s ease infinite;
    padding: 16px 20px 20px;
    color: white;
    box-shadow: 0 8px 24px rgba(255, 107, 129, 0.25);
    position: relative;
    overflow: hidden;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.header-decoration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.decoration-star {
    position: absolute;
    opacity: 0.4;
    animation: twinkle 2s ease-in-out infinite;
}

.decoration-star:nth-child(1) {
    top: 12px;
    left: 15%;
    font-size: 20px;
    animation-delay: 0s;
}

.decoration-star:nth-child(2) {
    top: 8px;
    right: 20%;
    font-size: 16px;
    animation-delay: 0.5s;
}

.decoration-star:nth-child(3) {
    bottom: 20px;
    right: 8%;
    font-size: 24px;
    animation-delay: 1s;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon-wrapper {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.logo-icon {
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
}

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

.logo-text-wrapper {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-weight: 800;
    font-size: 35px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.22);
    padding: 8px 14px;
    border-radius: 24px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.user-avatar-circle {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.6);
    overflow: hidden;
}

.user-avatar {
    font-size: 22px;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

.clickable:hover {
    transform: scale(1.1);
}

/* 头像放大模态框 */
.avatar-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.avatar-modal-content {
    position: relative;
    width: 500px;
    height: 500px;
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
    border: 6px solid transparent;
    background: 
        linear-gradient(white, white) padding-box,
        linear-gradient(135deg, #FFB6C1, #FFA07A, #FFD700, #FF69B4) border-box;
}

.avatar-modal-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.avatar-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border: none;
    font-size: 30px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    z-index: 10;
}

.avatar-modal-close:hover {
    transform: scale(1.1);
    background: #f0f0f0;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.user-greeting {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 1px;
}

.app-main {
    flex: 1;
    padding: 20px;
}

.page-content {
    animation: fadeIn 0.3s ease;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    color: var(--text);
}

.date-header {
    text-align: center;
    margin-bottom: 24px;
}

.date-header h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.weekday {
    color: var(--text-light);
    font-size: 16px;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

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

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

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    color: var(--text-light);
    font-size: 14px;
}

.celebration {
    background: linear-gradient(135deg, #FFF0C4 0%, #FFE66D 100%);
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transition: all 0.3s ease;
}

@keyframes bounceIn {
    0% { 
        transform: scale(0.3); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.05); 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

.celebration-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.celebration h2 {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--text);
}

.celebration p {
    color: var(--text-light);
}

.progress-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 500;
}

.progress-text {
    color: var(--primary);
}

.progress-bar {
    height: 16px;
    background: #E8E8E8;
    border-radius: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--pink) 100%);
    border-radius: 8px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
}

.task-card.checked {
    border-color: var(--success);
    background: linear-gradient(135deg, #E8FFF7 0%, #F0FFF9 100%);
    animation: checkinPop 0.4s ease-out;
}

@keyframes checkinPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.task-info {
    display: flex;
    gap: 16px;
    flex: 1;
    align-items: flex-start;
}

.task-icon {
    font-size: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.task-details {
    flex: 1;
}

.task-details h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.task-desc {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 8px;
}

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

.task-category,
.task-cycle,
.task-points {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #F0F0F0;
}

.task-points {
    background: #FFF0C4;
    color: #D49500;
}

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

.btn-checkin,
.btn-undo {
    padding: 10px 24px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-checkin {
    background: #ffb400;
    color: white;
}

.btn-checkin:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

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

.btn-undo {
    background: var(--success);
    color: white;
}

.btn-undo:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

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

.btn-study {
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, var(--purple) 0%, var(--blue) 100%);
    color: white;
    text-decoration: none;
    display: inline-block;
    margin-right: 8px;
}

.btn-study:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

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

.btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #F0F0F0;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 12px 28px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--pink) 100%);
    color: white;
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

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

.btn-danger {
    background: #FF6B6B;
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.form-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.form-card h3 {
    margin-bottom: 20px;
    font-size: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E8E8E8;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

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

.radio-group,
.checkbox-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-item,
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.radio-item input,
.checkbox-item input {
    width: auto;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.section-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 20px;
    margin-bottom: 20px;
}

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

.calendar-title {
    font-size: 18px;
    font-weight: 500;
}

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

.calendar-weekday {
    text-align: center;
    font-weight: 500;
    color: var(--text-light);
    padding: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #F8F9FA;
    font-weight: 500;
}

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

.calendar-day.complete {
    background: linear-gradient(135deg, var(--success) 0%, #00D199 100%);
    color: white;
}

.calendar-day.partial {
    background: linear-gradient(135deg, var(--yellow) 0%, #FFD93D 100%);
}

.calendar-legend {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light);
}

.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #E8E8E8;
}

.legend-dot.complete {
    background: var(--success);
}

.legend-dot.partial {
    background: var(--yellow);
}

.medals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.medal-card {
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.medal-card.unlocked {
    background: linear-gradient(135deg, #FFF5EB 0%, #FFF0F5 100%);
    border-color: var(--primary);
}

.medal-card.locked {
    background: #F8F9FA;
    opacity: 0.6;
}

.medal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.medal-info h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.medal-info p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.medal-meta {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.medal-category,
.medal-requirement {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 10px;
    background: rgba(0,0,0,0.05);
}

.medal-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--success);
    color: white;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 10px;
}

.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: center;
    padding: 12px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    z-index: 100;
}

.app-nav a {
    flex: 1;
    max-width: 200px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
}

.app-nav a.active {
    color: var(--primary);
    background: rgba(255, 159, 67, 0.1);
}

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

.nav-text {
    font-size: 12px;
    font-weight: 500;
}

@media (max-width: 600px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        font-size: 28px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .task-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .task-actions {
        justify-content: flex-end;
    }
    
    .medals-grid {
        grid-template-columns: 1fr;
    }
}

/* 专注模式 */
.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-header-content {
    flex: 1;
}

.btn-focus {
    background: linear-gradient(135deg, var(--primary) 0%, var(--pink) 100%);
    border: none;
    color: white;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 107, 129, 0.3);
}

.btn-focus:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 107, 129, 0.4);
}

.focus-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: white;
}

.focus-time {
    font-size: 120px;
    font-weight: 300;
    letter-spacing: 8px;
    margin-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.focus-duration {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 60px;
    letter-spacing: 2px;
}

.btn-exit-focus {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-exit-focus:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .focus-time {
        font-size: 72px;
        letter-spacing: 4px;
    }
}
