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

body {
    font-family: 'Space Mono', monospace;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

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

.container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 226, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    line-height: 1.1;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1.5px;
}

header p {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.2;
    margin-top: 0;
}

.input-section {
    margin-bottom: 2rem;
}

#promptInput {
    width: 100%;
    padding: 1.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    border: 3px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(45deg, #667eea, #764ba2) border-box;
    border-radius: 20px;
    resize: vertical;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

#promptInput:focus {
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.button-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.generate-btn {
    flex: 1;
    padding: 1.2rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.generate-btn:hover:not(:disabled)::before {
    left: 100%;
}

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

.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.generate-btn.loading .btn-text {
    display: none;
}

.generate-btn.loading .loading-spinner {
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-section {
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

.comic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.panel {
    aspect-ratio: 4/3.5;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    position: relative;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8efff 100%);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.panel:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(102, 126, 234, 0.5);
}

.panel-number {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: pulse 2s infinite;
}

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

.panel-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    padding: 1rem;
    transition: all 0.3s ease;
}

.panel-placeholder[style*="cursor: pointer"]:hover {
    color: #667eea;
    transform: translate(-50%, -50%) scale(1.05);
}

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

.speech-bubble {
    position: absolute;
    bottom: 5px;
    left: 15px;
    right: 15px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 255, 0.95) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    min-height: 32px;
    display: none;
    z-index: 2;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.speech-bubble:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.speech-bubble.visible {
    display: block;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #333;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 22px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
}

.panel.generating {
    background: linear-gradient(45deg, #f8f8f8 25%, transparent 25%, transparent 75%, #f8f8f8 75%, #f8f8f8),
                linear-gradient(45deg, #f8f8f8 25%, transparent 25%, transparent 75%, #f8f8f8 75%, #f8f8f8);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    animation: slide 2s linear infinite;
}

@keyframes slide {
    0% { background-position: 0 0, 10px 10px; }
    100% { background-position: 20px 20px, 30px 30px; }
}

.script-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 255, 0.9) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.script-section h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

#scriptOutput {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 255, 0.8) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 15px;
    padding: 1.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    outline: none;
}

#scriptOutput:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05), 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.continue-btn {
    width: 100%;
    padding: 1.2rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(45deg, #764ba2, #667eea);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.3);
}

.continue-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(118, 75, 162, 0.4);
}

.continue-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.continue-btn.loading .btn-text {
    display: none;
}

.continue-btn.loading .loading-spinner {
    display: block;
}

.clear-btn {
    padding: 1.2rem 1.8rem;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.settings-header {
    text-align: center;
    margin-bottom: 2rem;
}

.settings-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.settings-header p {
    color: #666;
    font-size: 1.1rem;
}

.settings-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 255, 0.9) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.settings-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #333;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.settings-row label {
    min-width: 150px;
    font-weight: 700;
    color: #333;
}

.settings-row select,
.settings-row input[type="text"],
.settings-row input[type="password"],
.settings-row input[type="number"] {
    flex: 1;
    padding: 0.8rem;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.settings-row select:focus,
.settings-row input[type="text"]:focus,
.settings-row input[type="password"]:focus,
.settings-row input[type="number"]:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.2);
}

.settings-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #333;
}

.checkbox-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    color: #333;
    cursor: pointer;
}

.settings-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.save-settings-btn {
    padding: 1.2rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.save-settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.reset-settings-btn {
    padding: 1.2rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(45deg, #6c757d, #868e96);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3);
}

.reset-settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.tab-btn {
    padding: 1rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.2);
}

.tab-btn.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.view {
    margin-top: 2rem;
}

.publish-btn {
    width: 100%;
    padding: 1.2rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

.publish-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(40, 167, 69, 0.4);
}

.publish-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.publish-btn.loading .btn-text {
    display: none;
}

.publish-btn.loading .loading-spinner {
    display: block;
}

.library-header {
    text-align: center;
    margin-bottom: 2rem;
}

.library-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.library-header p {
    color: #666;
    font-size: 1.1rem;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.library-controls {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.sort-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sort-controls label {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: #333;
}

.sort-controls select {
    padding: 0.8rem;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.sort-controls select:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.2);
}

.comic-card {
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 255, 0.9) 100%);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.comic-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border-color: rgba(102, 126, 234, 0.5);
}

.comic-card-header {
    margin-bottom: 1rem;
}

.comic-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.comic-card-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.comic-card-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.preview-panel {
    aspect-ratio: 4/3;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8efff 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

.comic-card-date {
    color: #999;
    font-size: 0.8rem;
    text-align: center;
}

.loading-message {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    grid-column: 1 / -1;
    padding: 2rem;
}

.empty-library {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    grid-column: 1 / -1;
    padding: 2rem;
}

.panel-info {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    overflow-y: auto;
    display: none;
    z-index: 10;
}

.panel-info.visible {
    display: block;
}

.panel-info h4 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #fff;
}

.panel-info p {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.panel-info .dialogue {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-style: italic;
}

.cancel-btn {
    padding: 1.2rem 1.8rem;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: none;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.delete-comic-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.delete-comic-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.regenerate-btn {
    width: 100%;
    padding: 1.2rem 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(45deg, #6f42c1, #8e5bde);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
    box-shadow: 0 8px 25px rgba(111, 66, 193, 0.3);
}

.regenerate-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(111, 66, 193, 0.4);
}

.regenerate-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.regenerate-btn.loading .btn-text {
    display: none;
}

.regenerate-btn.loading .loading-spinner {
    display: block;
}

.comic-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.comic-card-likes {
    display: flex;
    align-items: center;
}

.like-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 255, 0.8) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 107, 107, 0.3);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

.like-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.3);
    border-color: rgba(255, 107, 107, 0.5);
}

.like-icon {
    font-size: 1rem;
}

.like-count {
    color: #666;
    font-weight: 700;
}

.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 255, 0.9) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    width: 55px;
    height: 55px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.2);
}

.speech-edit-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.speech-edit-input {
    width: 100%;
    padding: 8px 12px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    border: 2px solid rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    outline: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.speech-edit-input:focus {
    border-color: rgba(102, 126, 234, 0.7);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.2);
}

.speech-edit-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.speech-save-btn,
.speech-cancel-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speech-save-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.speech-save-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.speech-cancel-btn {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.speech-cancel-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

.panel-error {
    border-color: rgba(255, 107, 107, 0.6) !important;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 142, 142, 0.1) 100%) !important;
}

.panel-error:hover {
    border-color: rgba(255, 107, 107, 0.8) !important;
    transform: translateY(-2px) scale(1.01) !important;
}

.panel-error .panel-placeholder {
    color: #d32f2f !important;
}

/* Dark mode styles */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
}

.regenerate-panel-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    z-index: 3;
    transition: background-color 0.3s ease;
}

.panel:hover .regenerate-panel-btn {
    display: flex; /* Show on hover */
}

.regenerate-panel-btn:hover {
    background-color: rgba(0,0,0,0.9);
}

body.dark-mode .regenerate-panel-btn {
    background: rgba(255,255,255,0.2);
    color: #e0e0e0;
}

body.dark-mode .regenerate-panel-btn:hover {
    background-color: rgba(255,255,255,0.4);
}

body.dark-mode .container::before {
    background: 
        radial-gradient(circle at 20% 80%, rgba(75, 85, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(198, 75, 150, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(75, 198, 190, 0.15) 0%, transparent 50%);
}

body.dark-mode header {
    background: rgba(26, 26, 46, 0.95);
    border-color: rgba(224, 224, 224, 0.1);
}

body.dark-mode #promptInput {
    background: linear-gradient(rgba(42, 42, 66, 0.9), rgba(42, 42, 66, 0.9)) padding-box,
                linear-gradient(45deg, #667eea, #764ba2) border-box;
    color: #e0e0e0;
}

body.dark-mode .panel {
    background: linear-gradient(135deg, rgba(42, 42, 66, 0.8) 0%, rgba(30, 30, 50, 0.8) 100%);
    border-color: rgba(224, 224, 224, 0.3);
}

body.dark-mode .panel-number {
    background: #e0e0e0;
    color: #1a1a1a;
}

body.dark-mode .panel-placeholder {
    color: #777;
}

body.dark-mode .speech-bubble {
    background: linear-gradient(135deg, rgba(42, 42, 66, 0.95) 0%, rgba(30, 30, 50, 0.95) 100%);
    border-color: rgba(102, 126, 234, 0.4);
    color: #e0e0e0;
}

body.dark-mode .speech-bubble::before {
    border-top-color: #555;
}

body.dark-mode .speech-bubble::after {
    border-top-color: #2a2a2a;
}

body.dark-mode .script-section {
    background: linear-gradient(135deg, rgba(42, 42, 66, 0.9) 0%, rgba(30, 30, 50, 0.9) 100%);
    border-color: rgba(224, 224, 224, 0.2);
}

body.dark-mode #scriptOutput {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8) 0%, rgba(22, 22, 38, 0.8) 100%);
    border-color: rgba(102, 126, 234, 0.3);
    color: #e0e0e0;
}

body.dark-mode #scriptOutput:focus {
    border-color: rgba(102, 126, 234, 0.6);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05), 0 0 0 2px rgba(102, 126, 234, 0.2);
}

body.dark-mode .settings-section {
    background: linear-gradient(135deg, rgba(42, 42, 66, 0.9) 0%, rgba(30, 30, 50, 0.9) 100%);
    border-color: rgba(224, 224, 224, 0.2);
}

body.dark-mode .tab-btn {
    background: rgba(42, 42, 66, 0.8);
    border-color: rgba(102, 126, 234, 0.4);
    color: #e0e0e0;
}

body.dark-mode .tab-btn:hover {
    background: #333;
}

body.dark-mode .tab-btn.active {
    background: #e0e0e0;
    color: #1a1a1a;
}

body.dark-mode .comic-card {
    background: linear-gradient(135deg, rgba(42, 42, 66, 0.9) 0%, rgba(30, 30, 50, 0.9) 100%);
    border-color: rgba(224, 224, 224, 0.3);
}

body.dark-mode .comic-card:hover {
    box-shadow: 0 8px 25px rgba(255,255,255,0.1);
}

body.dark-mode .author-avatar {
    border-color: #555;
}

body.dark-mode .preview-panel {
    border-color: #555;
    background: #333;
}

body.dark-mode .like-btn {
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .like-btn:hover {
    background: #333;
    border-color: #777;
}

body.dark-mode .delete-comic-btn {
    background: #dc3545;
}

body.dark-mode .delete-comic-btn:hover {
    background: #c82333;
}

body.dark-mode .progress-bar {
    background: #333;
}

body.dark-mode .progress-fill {
    background: #e0e0e0;
}

body.dark-mode .panel-info {
    background: rgba(0, 0, 0, 0.95);
}

@media (max-width: 768px) {
    .comic-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .panel {
        border-width: 2px;
    }
    
    .panel-number {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    .speech-bubble {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }
    
    .comic-grid {
        gap: 0.75rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .button-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .settings-row label {
        min-width: auto;
    }
}