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

/* * 改进：移除了所有雪花动画。
 * 将背景从单调的 #000854 替换为一个平滑、微妙的线性渐变。
 * 这样性能更好，视觉上也更简洁、更现代。
*/
body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    /* 从深蓝到更深的午夜蓝的微妙渐变 */
    background: linear-gradient(170deg, #000b70 0%, #000854 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

/* --- 所有 .snow, .snow-container, 和 @keyframes snow 相关的 CSS 已被移除 --- */


/* Main header outside container (保持不变) */
.main-header {
    text-align: center;
    padding: 40px 20px 20px;
    position: relative;
    z-index: 10;
}

.christmas-title {
    font-family: 'Mountains of Christmas', cursive;
    font-size: 4.2em;
    font-weight: 700;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

.christmas-title .christmas-gold {
    color: #ffd700;
    background: -webkit-linear-gradient(transparent, transparent), url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/191814/gold_glitter.gif) repeat;
    background: -o-linear-gradient(transparent, transparent) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.christmas-title .christmas-blue {
    color: #035ee2;
    background: -webkit-linear-gradient(transparent, transparent), url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/191814/blue_glitter.gif) repeat;
    background: -o-linear-gradient(transparent, transparent) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* * "磨砂玻璃" 容器样式 (保持不变)
 * 这将在新的渐变背景上看起来很棒。
*/
.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.15); 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    margin-top: 20px;
    margin-bottom: 20px;
    position: relative;
    z-index: 10;
    backdrop-filter: blur(12px); 
}

/* * 容器内的浅色文本 (保持不变)
*/
.container .subtitle-text {
    text-align: center;
    font-size: 1em;
    color: #f0f0f0; 
    margin-bottom: 30px;
    font-weight: 600;
}

.card-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #f0f0f0; 
    font-size: 1em;
}

.required {
    color: #e74c3c;
}

/*
 * 表单输入字段样式 (保持不变)
 * 白色背景提供了最佳的可读性。
*/
.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    background: white;
    color: #333; 
}

/* * 节日红色 :focus 状态 (保持不变)
*/
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e63946; /* 节日红色 */
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15); /* 匹配的红色光晕 */
}

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

.form-group input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #999;
    opacity: 1;
}

.form-group select option {
    background: #fff;
    color: #333;
}

.image-preview {
    margin-top: 10px;
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* * 节日红色按钮样式 (保持不变)
*/
.btn-primary {
    background: linear-gradient(135deg, #e63946 0%, #c1121f 100%); 
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.4); /* 红色阴影 */
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.generate-btn {
    /* 继承 .btn-primary 样式 */
}

.download-btn {
    /* 继承 .btn-primary 样式 */
    margin-top: 20px;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* * 加载覆盖层 (保持不变)
 * 它使用纯色背景，这没问题，因为它是一个临时状态。
*/
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000854;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    pointer-events: all;
}

.loading-content {
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tree-svg {
    max-height: 60vh;
    overflow: visible;
    margin-bottom: 30px;
}

.tree-svg path {
    fill: #379157;
    stroke: #379157;
    stroke-width: 0.2;
    transform: scale(0);
    transform-origin: 50% 50%;
    animation: star 8s ease-in-out infinite;
    animation-delay: calc(var(--no) * 0.025s);
    transform-box: fill-box;
}

@keyframes star {
    0% {
        transform: scale(0);
        animation-timing-function: cubic-bezier(0.74, 1.72, 0.57, 1.01);
    }
    10% {
        transform: scale(1);
    }
    65% {
        transform: translateY(0px) scale(1);
    }
    75% {
        transform: translateY(50px) scale(0);
    }
    100% {
        transform: translateY(0px) scale(0);
    }
}

.loading-text {
    font-size: 1.5em;
    margin-top: 30px;
    font-weight: 600;
    color: #fff;
}

.loading-subtext {
    font-size: 1em;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.8);
}
/* 加载覆盖层结束 */


/* * 结果容器的 "磨砂玻璃" 效果 (保持不变)
*/
.result-container {
    max-width: 800px;
    margin: 40px auto;
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.15); 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10;
    backdrop-filter: blur(12px); 
}

.result-container h2 {
    color: #ffffff; /* 浅色文本 */
    margin-bottom: 30px;
    font-size: 2em;
}

.result-image {
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.result-image img {
    max-width: 100%;
    height: auto;
    display: block;
}

.error-message {
    margin-top: 20px;
    padding: 15px;
    background: #fee;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    color: #c0392b;
    font-weight: 500;
}

/* 响应式媒体查询 (保持不变) */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .christmas-title {
        font-size: 2.5em;
    }

    .main-header {
        padding: 20px 10px 10px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* 阻止 iOS 缩放 */
    }

    .tree-svg {
        max-height: 40vh;
    }

    .result-container {
        padding: 20px;
        margin: 20px auto;
    }

    .result-container h2 {
        font-size: 1.5em;
    }
}