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

:root {
    --bg-warm: #F6F1E8;
    --surface-light: #FBF7EF;
    --surface-white: #FFFFFF;
    --border-warm: #E2D9C8;
    --text-primary: #1F2421;
    --text-muted: #8A8A80;
    --accent: #C8853F;
    --accent-hover: #A86B2C;
    --accent-tint: #F0E3D0;
    --dark-block: #2A2723;
    --shadow: 0 2px 12px rgba(42, 39, 35, 0.08);
    --shadow-hover: 0 4px 20px rgba(42, 39, 35, 0.12);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-warm);
    color: var(--text-primary);
    line-height: 1.6;
}

.navbar {
    background: rgba(251, 247, 239, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-warm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-text {
    font-family: 'DM Serif Display', 'Roboto Slab', serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-badge {
    background: var(--accent-tint);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stats-text strong {
    color: var(--accent);
    font-weight: 600;
}

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

.hero-section {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero-title {
    font-family: 'DM Serif Display', 'Roboto Slab', serif;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.hero-title .accent {
    color: var(--accent);
    font-style: italic;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.workspace {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    margin-top: 3rem;
}

.input-panel,
.results-panel {
    background: var(--surface-white);
    border: 1px solid var(--border-warm);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    font-family: 'DM Serif Display', 'Roboto Slab', serif;
    font-size: 1.75rem;
    font-weight: 700;
}

.eyebrow-pill {
    background: var(--accent-tint);
    color: var(--accent);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.homework-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-warm);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--surface-light);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 133, 63, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.variants-selector {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.variant-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-warm);
    border-radius: 8px;
    background: var(--surface-light);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.variant-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.variant-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.submit-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s;
    margin-top: 1rem;
}

.submit-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.submit-btn:active {
    transform: translateY(0);
}

.clear-btn {
    background: transparent;
    border: 1px solid var(--border-warm);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.results-content {
    min-height: 300px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.solution-card {
    background: var(--surface-light);
    border: 1px solid var(--border-warm);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.solution-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.solution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.solution-title {
    font-family: 'DM Serif Display', 'Roboto Slab', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.solution-badge {
    background: var(--dark-block);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.solution-body {
    color: var(--text-primary);
    line-height: 1.8;
}

.solution-body h4 {
    margin: 1rem 0 0.5rem;
    font-weight: 600;
}

.solution-body ul, .solution-body ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.solution-body p {
    margin-bottom: 0.75rem;
}

.solution-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-warm);
}

.action-btn {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--border-warm);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.history-section {
    margin-top: 3rem;
}

.history-section h2 {
    font-family: 'DM Serif Display', 'Roboto Slab', serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.history-card {
    background: var(--surface-white);
    border: 1px solid var(--border-warm);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    cursor: pointer;
}

.history-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.history-subject {
    background: var(--accent-tint);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-task {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
}

.modal.active {
    display: block;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    max-width: 800px;
    max-height: 90vh;
    margin: 5vh auto;
    background: var(--surface-white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-warm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: 'DM Serif Display', 'Roboto Slab', serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(246, 241, 232, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-warm);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

@media (max-width: 1024px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 1rem;
    }

    .nav-container {
        padding: 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .history-grid {
        grid-template-columns: 1fr;
    }
}