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

body {
    font-family: 'Cal Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fafafa;
    color: #1a1a1a;
    line-height: 1.6;
}

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

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

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05) rotate(5deg);
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.input-section {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e5e5;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #007acc;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 122, 204, 0.15);
}

.generate-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #007acc, #005299);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 204, 0.3);
}

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

.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-loader::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.output-section {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e5e5;
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.output-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.output-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #007acc;
    color: white;
    border-color: #007acc;
}

.script-output {
    padding: 2rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    max-height: 80vh;
    overflow-y: auto;
}

.script-output h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #007acc;
    margin: 2rem 0 1rem 0;
    font-family: 'Cal Sans', sans-serif;
}

.script-output h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #007acc;
    margin: 1.5rem 0 1rem 0;
    font-family: 'Cal Sans', sans-serif;
}

.script-output h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin: 1.5rem 0 0.5rem 0;
    font-family: 'Cal Sans', sans-serif;
}

.script-output h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
    margin: 1rem 0 0.5rem 0;
    font-family: 'Cal Sans', sans-serif;
}

.script-output p {
    margin-bottom: 1rem;
}

.script-output strong {
    font-weight: 700;
    color: #1a1a1a;
}

.script-output em {
    font-style: italic;
    color: #555;
}

.chapter-title {
    font-weight: 700;
    color: #007acc;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid #e5e5e5;
}

.chapter-title:first-child {
    margin-top: 0;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .input-section {
        padding: 1.5rem;
    }
    
    .output-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .action-btn {
        flex: 1;
        text-align: center;
    }
}