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

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-size: 2.5em;
    background: linear-gradient(45deg, #ffffff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
    font-size: 1.8em;
    text-align: center;
    background: linear-gradient(45deg, #3498db, #2c3e50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.input-section, .preview-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
}

.form-group {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.form-group:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

.image-options {
    margin-bottom: 10px;
}

.image-options input[type="radio"] {
    margin-right: 5px;
}

.image-options label {
    display: inline-block;
    margin-right: 15px;
    font-weight: normal;
    cursor: pointer;
}

.template-selection {
    margin-top: 10px;
}

.template-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.template-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.template-img:hover {
    border-color: #3498db;
    transform: scale(1.05);
}

.template-img.selected {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}


input[type="text"], textarea, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background-color: #fff;
}

input[type="text"]:focus, textarea:focus, select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
}

input[type="range"] {
    width: 70%;
    margin-right: 10px;
}

textarea {
    height: 120px;
    resize: vertical;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* 高级设置切换按钮样式 */
.advanced-toggle {
    margin-bottom: 20px;
    text-align: center;
}

.advanced-toggle-btn {
    background-color: #9b59b6;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.advanced-toggle-btn:hover {
    background-color: #8e44ad;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.advanced-toggle-btn:active {
    background-color: #8e44ad;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#uploadTemplateBtn {
    background-color: #2ecc71;
    padding: 8px 15px;
    font-size: 14px;
}

#uploadTemplateBtn:hover {
    background-color: #27ae60;
}

#posterCanvas {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.poster {
    width: 375px; /* iPhone X宽度 */
    height: 667px; /* iPhone X高度 */
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    border: 3px solid #fff;
}

.poster::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    filter: brightness(0.8);
    z-index: -1;
    border-radius: 10px;
}

.poster-element {
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
}

.poster h3 {
    font-size: 32px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.poster h4 {
    font-size: 22px;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.poster p {
    font-size: 16px;
    line-height: 1.6;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 70%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .input-section, .preview-section {
        padding: 15px;
    }
    
    .poster {
        width: 100%;
        height: auto;
        aspect-ratio: 9/16; /* 保持手机屏幕比例 */
        min-height: 400px;
    }
    
    .poster h3 {
        font-size: 28px;
    }
    
    .poster h4 {
        font-size: 20px;
    }
    
    .poster p {
        font-size: 16px;
    }
    
    /* 手机端优化 */
    input[type="text"], textarea, button {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .form-group label {
        font-size: 16px;
    }
    
    #posterCanvas {
        overflow-x: auto;
    }
    
    /* 移动端表单组优化 */
    .form-group {
        padding: 10px;
    }
}

/* 滚动条样式优化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* 焦点环样式优化 */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}