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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, 'Trebuchet MS', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.test-section {
    text-align: right;
    margin-bottom: 20px;
}

.test-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: normal;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    opacity: 0.8;
}

.test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.nav-left h1 {
    font-size: 1.8em;
    color: #4a4a4a;
    margin: 0;
}

.nav-right {
    display: flex;
    gap: 10px;
}

.nav-right .nav-btn {
    background: linear-gradient(45deg, #00b894, #00a085);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.85em;
    transition: transform 0.2s;
}

.nav-right .nav-btn:hover {
    transform: translateY(-2px);
}

.logout-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24) !important;
}

.logout-btn:hover {
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3) !important;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h2 {
    font-size: 2em;
    color: #4a4a4a;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    color: #666;
}

.question-group {
    margin-bottom: 25px;
}

.question-group label {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    padding: 10px;
    background: #f0f8ff;
    border-radius: 10px;
    border-left: 5px solid #667eea;
}

.question-group textarea {
    width: 100%;
    min-height: 80px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    resize: vertical;
    transition: border-color 0.3s;
}

.question-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.question-group textarea::placeholder {
    color: #999;
    font-style: italic;
}

button {
    width: 100%;
    padding: 20px;
    font-size: 1.3em;
    font-weight: bold;
    color: white;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    margin-top: 20px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(238, 90, 36, 0.4);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.story-content {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 15px;
    font-size: 1.2em;
    line-height: 1.8;
    color: #333;
    border: 3px solid #667eea;
    margin: 20px 0;
}

.error {
    background: #ffe6e6;
    color: #d63031;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #d63031;
}

.loading {
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

#storyResult h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

#storyResult button {
    background: linear-gradient(45deg, #00b894, #00a085);
    margin-top: 25px;
}

#storyResult button:hover {
    box-shadow: 0 5px 15px rgba(0, 184, 148, 0.4);
}

/* Gallery Styles */
.nav-buttons {
    margin-top: 20px;
}

.nav-btn {
    display: inline-block;
    background: linear-gradient(45deg, #00b894, #00a085);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: bold;
    transition: transform 0.3s, box-shadow 0.3s;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 184, 148, 0.4);
}

.stories-grid {
    display: grid;
    gap: 20px;
    margin-top: 30px;
}

.story-card {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 15px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.story-header h3 {
    color: #667eea;
    font-size: 1.5em;
    margin: 0;
}

.story-date {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
}

.story-preview {
    background: white;
    padding: 15px;
    border-radius: 10px;
    line-height: 1.5;
    font-size: 1em;
    color: #555;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.story-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.view-btn, .copy-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 0.9em;
}

.view-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.copy-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
}

.view-btn:hover, .copy-btn:hover {
    transform: translateY(-2px);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.create-first-btn {
    display: inline-block;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1.2em;
    font-weight: bold;
    margin-top: 20px;
    transition: transform 0.3s;
}

.create-first-btn:hover {
    transform: translateY(-3px);
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.expanded-story {
    font-size: 1.3em;
    line-height: 1.8;
    color: #333;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .question-group label {
        font-size: 1em;
    }
    
    .story-content {
        font-size: 1.1em;
    }
    
    .story-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

/* Config Page Styles */
.config-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.config-editor, .config-list {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #ddd;
}

.config-editor h3, .config-list h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.3em;
}

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

.form-group label {
    display: block;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

/* Questions Builder Styles */
.questions-builder {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    background: white;
}

.question-item {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s;
}

.question-item:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.question-number {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.remove-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    transition: transform 0.2s;
}

.remove-btn:hover {
    transform: scale(1.1);
}

.question-fields {
    display: grid;
    gap: 15px;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    font-size: 0.9em;
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
}

.field-group input, .field-group textarea {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    transition: border-color 0.3s;
}

.field-group input:focus, .field-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.field-group textarea {
    min-height: 60px;
    resize: vertical;
}

.add-question-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    margin-top: 10px;
}

.add-question-btn:hover {
    transform: translateY(-2px);
}

.config-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.save-btn, .clear-btn, .preview-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.save-btn {
    background: linear-gradient(45deg, #00b894, #00a085);
    color: white;
}

.clear-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
}

.preview-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.save-btn:hover, .clear-btn:hover, .preview-btn:hover {
    transform: translateY(-2px);
}

.configs-grid {
    display: grid;
    gap: 15px;
}

.config-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    transition: transform 0.2s, box-shadow 0.2s;
}

.config-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.config-card h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.config-meta {
    color: #666;
    font-size: 0.8em;
    margin-bottom: 12px;
}

.config-actions-small {
    display: flex;
    gap: 8px;
}

.load-btn, .use-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.load-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.use-btn {
    background: linear-gradient(45deg, #00b894, #00a085);
    color: white;
}

.load-btn:hover, .use-btn:hover {
    transform: translateY(-1px);
}

.empty-config {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.question-preview {
    max-height: 400px;
    overflow-y: auto;
}

.preview-question {
    margin-bottom: 20px;
}

.preview-question label {
    display: block;
    margin-bottom: 8px;
    color: #333;
}

.preview-question textarea {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

@media (max-width: 900px) {
    .config-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .config-actions {
        flex-direction: column;
    }
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header h1 {
    color: #4a4a4a;
    font-size: 2.2em;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 30px;
}

.login-form {
    margin-bottom: 30px;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.error-message {
    background: #ffe6e6;
    color: #d63031;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #d63031;
    font-weight: bold;
}

.login-footer {
    color: #999;
    font-size: 0.9em;
}

@media (max-width: 500px) {
    .login-box {
        padding: 30px 20px;
    }
    
    .login-header h1 {
        font-size: 1.8em;
    }
}