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

:root {
    --primary-color: #8b4513;
    --primary-hover: #6d3610;
    --secondary-color: #d4a574;
    --background-color: #faf8f5;
    --card-background: #ffffff;
    --text-color: #2c1810;
    --text-muted: #6b5b4f;
    --border-color: #e8ddd4;
    --accent-color: #c9a66b;
    --shadow-sm: 0 2px 4px rgba(44, 24, 16, 0.08);
    --shadow-md: 0 4px 12px rgba(44, 24, 16, 0.12);
    --shadow-lg: 0 8px 24px rgba(44, 24, 16, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 40px 20px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Main Content */
main {
    flex: 1;
}

/* Controls Section */
.controls {
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.control-group select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--text-color);
    background-color: var(--card-background);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b5b4f' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.control-group select:hover {
    border-color: var(--secondary-color);
}

.control-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.15);
}

.generate-button {
    grid-column: 1 / -1;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.generate-button:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.3rem;
}

/* Result Container */
.result-container {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.placeholder p {
    font-size: 1.1rem;
}

/* Event Card */
.event-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 30px;
    animation: fadeIn 0.5s ease;
}

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

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.event-badge {
    background: var(--secondary-color);
    color: var(--primary-hover);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-year {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.event-title {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.3;
}

.event-meta {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.meta-icon {
    font-size: 1.1rem;
}

.event-description {
    background: linear-gradient(135deg, #fdfcfb, #f8f4ef);
    padding: 25px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-color);
    margin-bottom: 30px;
    font-size: 1.05rem;
    line-height: 1.7;
}

/* Character Section */
.character-section {
    margin-bottom: 30px;
}

.character-section h3,
.story-hooks h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.character-card {
    background: var(--background-color);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.character-role {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
}

.character-description {
    color: var(--text-muted);
    margin-bottom: 15px;
    line-height: 1.6;
}

.character-motivation {
    font-size: 0.95rem;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}

.character-motivation strong {
    color: var(--primary-color);
}

/* Story Hooks */
.story-hooks {
    margin-bottom: 30px;
}

.story-hooks ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.story-hooks li {
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    position: relative;
    padding-left: 35px;
}

.story-hooks li::before {
    content: '💡';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 150px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn.primary {
    background: var(--primary-color);
    color: white;
}

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

.action-btn.secondary {
    background: var(--background-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.action-btn.secondary:hover {
    border-color: var(--secondary-color);
    background: var(--card-background);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
}

footer a:hover {
    color: var(--primary-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }

    header {
        padding: 30px 15px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .controls {
        padding: 20px;
        grid-template-columns: 1fr;
    }

    .event-card {
        padding: 20px;
    }

    .event-title {
        font-size: 1.4rem;
    }

    .event-description {
        padding: 20px;
        font-size: 1rem;
    }

    .event-meta {
        flex-direction: column;
        gap: 10px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .event-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .character-card {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    .controls,
    .action-buttons,
    footer {
        display: none;
    }

    .event-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
