:root {
    --primary: #2383e2;
    --primary-hover: #1b66b1;
    --background: #ffffff;
    --sidebar-bg: #f7f7f5;
    --text: #37352f;
    --text-muted: #73726e;
    --border: rgba(55, 53, 47, 0.09);
    --border-dark: rgba(55, 53, 47, 0.16);
    --card-bg: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --notion-red: #eb5757;
    --notion-green: #2ecc71;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    background: var(--background);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.presentation-container {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    height: 100%;
}

.slide {
    min-width: 100vw;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 1.5rem 1.5rem 1.5rem;
    /* Increased top padding for nav */
    position: relative;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.slide.active {
    opacity: 1;
}

.content {
    max-width: 1000px;
    width: 95%;
    background: var(--card-bg);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    /* Changed from flex-start to center for better vertical alignment */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.content.no-image {
    max-width: 600px;
    display: block;
}

.content.no-image .text-box {
    width: 100%;
}

.image-box {
    flex: 0 0 40%;
    border-radius: 4px;
    overflow: hidden;
    height: 300px;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.image-box img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    mix-blend-mode: multiply;
    /* Helps integrate generated images with white bg if they have light edges */
}

.text-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow: visible;
    /* Prevent internal scrollbars */
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text);
}

.nav-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background);
    border-top: 1px solid var(--border);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 100;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-dark);
    color: var(--text);
    padding: 0.4rem 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: var(--sidebar-bg);
}

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

.nav-btn.primary:hover {
    background: var(--primary-hover);
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.input-area {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.math-input {
    background: #fff;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.math-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.1);
}

.choice-btn {
    text-align: left;
    transition: all 0.2s;
    cursor: pointer;
}

.choice-btn:hover {
    background: var(--sidebar-bg);
}

.math-input.correct {
    border-color: var(--notion-green);
    background: rgba(46, 204, 113, 0.05);
}

.math-input.incorrect {
    border-color: var(--notion-red);
    background: rgba(235, 87, 87, 0.05);
}

.grid-cell {
    transition: all 0.1s ease;
    border: 1px solid var(--border);
}

.grid-cell:hover {
    background: var(--sidebar-bg);
}

.grid-cell.active {
    background: var(--primary) !important;
    border-color: var(--primary);
}

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    z-index: 200;
}

.nav-box {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg);
    position: relative;
}

.nav-box:hover {
    background: var(--sidebar-bg);
    border-color: var(--primary);
}

.nav-box.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.nav-box.answered::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--notion-green);
    color: white;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.submit-btn {
    background: var(--notion-green);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.submit-btn:hover {
    background: #27ae60;
}

.validation-msg {
    color: var(--notion-red);
    font-size: 0.9rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(235, 87, 87, 0.05);
    border-radius: 4px;
    border: 1px solid rgba(235, 87, 87, 0.1);
}

/* Scrollbar styling - Notion style */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(55, 53, 47, 0.16);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(55, 53, 47, 0.24);
}

/* Badge style for level */
.level-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f0f7ff;
    border: 1px solid #cce3fd;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-height: 700px) {
    .content {
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .image-box {
        height: 200px;
    }

    h1 {
        font-size: 1.25rem;
    }
}