* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin: 20px 0;
    font-size: 2.5rem;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.generator-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 30px;
}

.input-section, .result-section {
    flex: 1;
    min-width: 300px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

#prompt-input {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: none;
    font-size: 1rem;
    margin-bottom: 15px;
}

.settings {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.style-selector, .aspect-selector {
    flex: 1;
    min-width: 120px;
}

select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-size: 0.9rem;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#generate-btn {
    background-color: #4a6fa5;
    color: white;
    width: 100%;
    font-size: 1rem;
}

#generate-btn:hover {
    background-color: #3a5980;
}

#extend-btn {
    background-color: #ff9800;
    color: white;
}

#extend-btn:hover {
    background-color: #e68a00;
}

#fullscreen-btn {
    background-color: #673ab7;
    color: white;
}

#fullscreen-btn:hover {
    background-color: #5e35b1;
}

.result-section {
    flex: 1;
    min-width: 300px;
    max-height: 600px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    border-radius: 6px;
    padding: 20px;
}

#loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

#loading-indicator p {
    margin-top: 10px;
    font-style: italic;
    color: #666;
}

.panel-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.panel-number-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-number-controls button {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background-color: #f0f0f0;
}

.panel-number-controls button:hover {
    background-color: #e0e0e0;
}

#panel-count {
    font-weight: bold;
    font-size: 1.2rem;
    min-width: 30px;
    text-align: center;
    cursor: pointer;
}

.panel-count-input {
    width: 50px;
    text-align: center;
    font-size: 1.2rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 5px;
}

.comic-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.comic-panel {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
}

.comic-panel img {
    width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.panel-regenerate-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 4px;
}

.comic-panel:hover .panel-regenerate-overlay {
    opacity: 1;
}

.regenerate-panel-btn {
    background-color: #4a6fa5;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.regenerate-panel-btn:hover {
    background-color: #3a5980;
}

.loading-panel {
    position: relative;
}

.loading-panel::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="%23333" stroke-width="5" stroke-dasharray="60 20" stroke-linecap="round"><animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0 25 25" to="360 25 25" dur="1s" repeatCount="indefinite"/></circle></svg>') center no-repeat;
    border-radius: 4px;
    z-index: 5;
}

.panel-caption {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.manga-panel {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

#manga-image {
    max-width: 100%;
    max-height: 400px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.result-controls {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

#save-btn {
    background-color: #4caf50;
    color: white;
}

#save-btn:hover {
    background-color: #3a8c3e;
}

#new-btn {
    background-color: #f0f0f0;
    color: #333;
}

#new-btn:hover {
    background-color: #e0e0e0;
}

.gallery-section {
    margin-top: 30px;
}

h2 {
    margin-bottom: 15px;
    font-size: 1.8rem;
    color: #333;
}

#gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.gallery-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    height: 200px;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

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

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    font-size: 0.8rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-delete-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.7rem;
    cursor: pointer;
}

.gallery-delete-btn:hover {
    background-color: #c0392b;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.multi-panel-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(74, 111, 165, 0.8);
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

#progress-text {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

.version-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 6px;
    width: 100%;
}

.version-btn {
    padding: 6px 12px;
    background-color: #4a6fa5;
    color: white;
    font-size: 0.9rem;
}

.jump-start-btn {
    background-color: #ff9800;
    margin-right: auto;
}

.version-btn:hover {
    background-color: #3a5980;
}

.version-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(255, 165, 0, 0.8);
    color: white;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    font-weight: bold;
}

.hidden {
    display: none !important;
}

.fullscreen-comic {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
}

.fullscreen-comic .comic-panel {
    max-width: 90%;
    max-height: 90vh;
    margin: 10px auto;
}

.fullscreen-comic .comic-panel img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.fullscreen-exit {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    color: #333;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 1001;
}

@media (max-width: 768px) {
    .generator-container {
        flex-direction: column;
    }
    
    .input-section, .result-section {
        width: 100%;
    }
}