* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.title {
    text-align: center;
    color: white;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.controls {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.control-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.upload-btn, .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.upload-btn {
    background: #4CAF50;
    color: white;
    display: inline-block;
}

.upload-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn {
    background: #2196F3;
    color: white;
}

.btn:hover {
    background: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}

.edit-btn {
    background: #9C27B0;
    color: white;
}

.edit-btn:hover {
    background: #7B1FA2;
    box-shadow: 0 5px 15px rgba(156, 39, 176, 0.4);
}

.save-btn {
    background: #FF9800;
}

.save-btn:hover {
    background: #e68900;
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

.theme-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-selector label {
    font-weight: bold;
    color: #333;
}

.theme-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.theme-btn:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.theme-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.card-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.diary-card {
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.diary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

/* 男生版主题 */
.theme-male {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-male .card-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 3px solid #667eea;
}

.theme-male .card-body {
    background: rgba(255, 255, 255, 0.98);
}

.theme-male .card-footer {
    background: rgba(102, 126, 234, 0.9);
    color: white;
}

/* 女生版主题 */
.theme-female {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.theme-female .card-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 3px solid #f093fb;
}

.theme-female .card-body {
    background: rgba(255, 255, 255, 0.98);
}

.theme-female .card-footer {
    background: rgba(240, 147, 251, 0.9);
    color: white;
}

/* 可爱版主题 */
.theme-cute {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.theme-cute .card-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 3px solid #fcb69f;
}

.theme-cute .card-body {
    background: rgba(255, 255, 255, 0.98);
}

.theme-cute .card-footer {
    background: rgba(252, 182, 159, 0.9);
    color: white;
}

/* 暗黑版主题 */
.theme-dark {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.theme-dark .card-header {
    background: rgba(44, 62, 80, 0.95);
    border-bottom: 3px solid #e74c3c;
    color: white;
}

.theme-dark .card-title {
    color: white;
}

.theme-dark .date {
    color: #ecf0f1;
}

.theme-dark .card-body {
    background: rgba(52, 73, 94, 0.98);
    color: #ecf0f1;
}

.theme-dark .card-footer {
    background: rgba(231, 76, 60, 0.9);
    color: white;
}

/* 渐变版主题 */
.theme-gradient {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.theme-gradient .card-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 3px solid #fa709a;
}

.theme-gradient .card-body {
    background: rgba(255, 255, 255, 0.98);
}

.theme-gradient .card-footer {
    background: rgba(250, 112, 154, 0.9);
    color: white;
}

.card-header {
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-text {
    flex: 1;
}

.card-title {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 5px;
}

.date {
    color: #666;
    font-size: 0.95em;
}

.card-body {
    padding: 30px 25px;
    min-height: 200px;
}

.diary-content {
    font-size: 1.1em;
    line-height: 1.8;
    color: #333;
    text-align: justify;
}

.diary-content p {
    margin-bottom: 15px;
}

.card-footer {
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.footer-icon {
    font-size: 1.5em;
}

.footer-text {
    font-size: 0.95em;
    font-weight: bold;
}

.tips {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    color: #666;
}

.tips p {
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .title {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    
    .controls {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .control-group {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .upload-btn, .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .theme-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .theme-btn {
        width: 100%;
        text-align: center;
    }
    
    .card-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .avatar-container {
        width: 100px;
        height: 100px;
    }
    
    .card-title {
        font-size: 1.5em;
    }
    
    .card-body {
        padding: 20px 15px;
    }
    
    .diary-content {
        font-size: 1em;
    }
    
    .tips {
        padding: 12px;
        font-size: 14px;
    }
    
    /* 模态框移动端优化 */
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.3em;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    #diary-editor {
        min-height: 180px;
        font-size: 15px;
        padding: 12px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
    
    .cancel-btn {
        margin-top: 10px;
    }
}

/* 编辑日记模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-btn {
    font-size: 32px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    line-height: 1;
}

.close-btn:hover {
    transform: rotate(90deg);
    opacity: 0.8;
}

.modal-body {
    padding: 25px;
}

#diary-editor {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
    resize: vertical;
    transition: border-color 0.3s;
    line-height: 1.8;
}

#diary-editor:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.2);
}

.char-count {
    text-align: right;
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

#char-count {
    font-weight: bold;
    color: #667eea;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.cancel-btn {
    background: #9E9E9E;
    color: white;
}

.cancel-btn:hover {
    background: #757575;
    box-shadow: 0 5px 15px rgba(158, 158, 158, 0.4);
}

.confirm-btn {
    background: #4CAF50;
    color: white;
}

.confirm-btn:hover {
    background: #45a049;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
