:root {
    --primary-color: #2c3e50;
    --accent-color: #e74c3c;
    --bg-color: #f4f4f4;
    --panel-bg: #ffffff;
    --text-color: #333;
    --border-style: 2px solid #000;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    background-image: radial-gradient(#ccc 1px, transparent 1px);
    background-size: 20px 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* 语言切换器 */
.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
    z-index: 100;
}

.lang-btn {
    background: #fff;
    border: 2px solid #ddd;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.lang-btn:hover {
    border-color: #000;
}

.lang-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

@media (max-width: 600px) {
    .lang-switcher {
        position: relative;
        top: 0;
        right: 0;
        justify-content: center;
        margin-bottom: 15px;
    }
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
    border-bottom: var(--border-style);
    background-color: #fff;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.1);
}

h1 {
    font-size: 3em;
    margin: 0;
    letter-spacing: 5px;
    text-transform: uppercase;
    font-weight: 900;
    color: #000;
}

.subtitle {
    font-size: 1.2em;
    color: #666;
    margin-top: 10px;
    font-style: italic;
}

/* Input Section */
.input-section {
    background: var(--panel-bg);
    padding: 30px;
    border: var(--border-style);
    margin-bottom: 30px;
    box-shadow: 8px 8px 0px rgba(0,0,0,0.2);
}

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

label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.1em;
    border-left: 5px solid #000;
    padding-left: 10px;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    min-height: 150px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}

textarea:focus {
    border-color: #000;
    outline: none;
}

/* Image Upload */
.upload-area {
    border: 3px dashed #ccc;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #000;
    background: #eee;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid #ddd;
    overflow: hidden;
    background: #fff;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255,0,0,0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Style Selection Grid */
.style-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.style-card {
    background: #fff;
    border: 3px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.style-card:hover {
    border-color: #000;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.style-card.active {
    border-color: #000;
    background: #f0f0f0;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.15);
    font-weight: bold;
}

.style-emoji {
    font-size: 1em;
    margin-right: 6px;
    display: inline-block;
}

.style-name {
    font-size: 0.95em;
    color: #333;
    display: inline-block;
}

.style-card.active .style-name {
    font-weight: bold;
}

/* 风格加载状态 */
.style-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 14px;
}

@media (max-width: 768px) {
    .style-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .style-card {
        padding: 10px 12px;
    }
    
    .style-name {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .style-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Buttons */
.action-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: #000;
    color: #fff;
    border: none;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s;
}

.action-btn:hover {
    background: #333;
    transform: translateY(-2px);
}

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

.action-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Script Editor */
.script-section {
    display: none; /* Hidden by default */
    background: var(--panel-bg);
    padding: 30px;
    border: var(--border-style);
    margin-bottom: 30px;
    box-shadow: 8px 8px 0px rgba(0,0,0,0.2);
}

.script-panel {
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #eee;
    margin-bottom: 15px;
    border-left: 4px solid #000;
}

.script-panel h3 {
    margin-top: 0;
    font-size: 1em;
    color: #555;
}

.script-input {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #ddd;
    box-sizing: border-box;
}

/* Comic Result */
.result-section {
    display: none;
    margin-top: 40px;
    text-align: center;
}

.comic-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 单张完整漫画结果容器 */
.comic-result-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.comic-result-container img {
    width: 100%;
    max-width: 1000px;
    height: auto;
    border: 5px solid #000;
    box-shadow: 15px 15px 0px rgba(0,0,0,0.15);
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.comic-panel {
    background: #fff;
    border: 4px solid #000;
    box-shadow: 5px 5px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.comic-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-bottom: 3px solid #000;
}

.comic-dialogue {
    padding: 15px;
    font-family: "Comic Sans MS", "Chalkboard SE", sans-serif;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    font-size: 1.1em;
}

/* Loading */
.loading {
    text-align: center;
    display: none;
    margin: 20px 0 80px 0;
    font-weight: bold;
    font-size: 1.2em;
    padding-bottom: 40px;
}

.loading-dots:after {
    content: '.';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .comic-result-container {
        max-width: 100%;
        padding: 0 10px;
    }
    
    .comic-result-container img {
        max-width: 100%;
        border-width: 3px;
        box-shadow: 10px 10px 0px rgba(0,0,0,0.12);
    }
}

@media (max-width: 600px) {
    .comic-grid {
        padding: 10px;
    }
}

/* 页脚 */
.site-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    border-top: 1px solid #ddd;
    color: #666;
    font-size: 0.9em;
}

.site-footer p {
    margin: 0 0 10px 0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #000;
    text-decoration: underline;
}

.footer-links .divider {
    color: #ccc;
}
