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

body {
    font-family: 'SimSun', '宋体', serif;
    background: linear-gradient(135deg, #f5f5dc 0%, #e6e6ce 100%);
    color: #2c1810;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

/* 古风背景纹理 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(139, 115, 85, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 115, 85, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(139, 115, 85, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* 容器样式 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(139, 115, 85, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #8b7355, #d4af37);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    font-style: italic;
}

/* 主内容区样式 */
.main-content {
    min-height: 500px;
}

/* 输入区域样式 */
.input-section {
    background: rgba(255, 255, 255, 0.8);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(139, 115, 85, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 30px;
}

.input-container {
    position: relative;
    margin-bottom: 20px;
}

.user-input {
    width: 100%;
    padding: 20px;
    border: 2px solid #e0d5c7;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.user-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    background: rgba(255, 255, 255, 1);
}

.user-input::placeholder {
    color: #999;
    font-style: italic;
}

.char-count {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 0.9rem;
    color: #666;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 8px;
    border-radius: 10px;
}

/* 按钮样式 */
.generate-btn {
    width: 100%;
    padding: 18px 30px;
    background: linear-gradient(45deg, #d4af37, #f4d03f);
    color: #2c1810;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    font-family: inherit;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
    background: linear-gradient(45deg, #f4d03f, #d4af37);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-text {
    display: inline-block;
    transition: transform 0.3s ease;
}

.generate-btn:hover .btn-text {
    transform: scale(1.05);
}

/* 结果展示区样式 */
.result-section {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(139, 115, 85, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease;
}

.result-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0d5c7;
}

.result-header h3 {
    font-size: 1.5rem;
    color: #8b7355;
    font-weight: bold;
}

.zen-content {
    background: linear-gradient(145deg, #faf8f3, #f0ede5);
    padding: 25px;
    border-radius: 15px;
    font-size: 1.2rem;
    line-height: 1.8;
    text-align: justify;
    margin-bottom: 25px;
    border-left: 4px solid #d4af37;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.zen-content::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 3rem;
    color: #d4af37;
    opacity: 0.3;
}

.zen-content::after {
    content: '"';
    position: absolute;
    bottom: -20px;
    right: 10px;
    font-size: 3rem;
    color: #d4af37;
    opacity: 0.3;
}

/* 操作按钮样式 */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn, .new-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-width: 140px;
}

.share-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6);
}

.new-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.new-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
}

/* 加载状态样式 */
.loading-section {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(139, 115, 85, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.lotus {
    font-size: 4rem;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    text-align: center;
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* 限制最大高度 */
}

.modal-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
    position: relative;
}

.modal-header h3 {
    color: #2c1810;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 10px;
    text-align: center;
    overflow-y: auto; /* 当内容超高时，允许滚动 */
    flex-grow: 1; /* 使其填充可用空间 */
}

.generated-image {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    object-fit: contain; /* 保持图片比例 */
    max-height: 100%; /* 限制图片最大高度 */
}

.image-info {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.info-text {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.generation-time {
    margin: 0;
    color: #6c757d;
    font-size: 0.8rem;
    font-style: italic;
}

.modal-footer {
    padding: 20px 0 0;
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    gap: 15px;
    justify-content: center;
    border-top: 1px solid #eee;
    flex-shrink: 0; /* 防止页脚收缩 */
}

.download-btn, .copy-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.download-btn {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
}

.copy-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
}

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

/* 新的导出按钮样式 */
.export-btn {
    padding: 15px 35px;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.export-btn.primary {
    background: linear-gradient(135deg, #d4af37, #f4e19c);
    color: #2c1810;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

.export-btn.primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.export-btn.primary:hover::before {
    width: 300px;
    height: 300px;
}

.export-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.5);
}

.copy-btn, .share-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.copy-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
}

.share-btn {
    background: linear-gradient(45deg, #07c160, #06ad56);
    color: white;
}

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

@keyframes glow {
    from {
        box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    }
    to {
        box-shadow: 0 4px 25px rgba(212, 175, 55, 0.6);
    }
}

/* 页面底部样式 */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: #666;
    font-style: italic;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .title {
        font-size: 2rem;
    }

    .header {
        padding: 20px 15px;
        margin-bottom: 30px;
    }

    .input-section {
        padding: 20px;
    }

    .result-section {
        padding: 20px;
    }

    .zen-content {
        font-size: 1.1rem;
        padding: 20px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .share-btn, .new-btn {
        width: 100%;
        max-width: 200px;
    }

    .modal-content {
        max-width: 95%;
        margin: 20px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .download-btn, .copy-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
    }

    .user-input {
        font-size: 1rem;
        padding: 15px;
    }

    .generate-btn {
        font-size: 1.1rem;
        padding: 15px 25px;
    }

    .zen-content {
        font-size: 1rem;
    }
}