:root {
    --bg-main: #f0f2f5;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --accent: #1a73e8;
    --text-primary: #1f1f1f;
    --text-secondary: #5f6368;
    --border: #e0e0e0;
    --code-bg: #f8f9fa;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    margin: 0; 
    display: flex; 
    height: 100vh;
}

/* Sidebar: Desktop */
.sidebar { 
    width: 320px; 
    background: var(--bg-sidebar); 
    border-right: 1px solid var(--border); 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0;
}
.sidebar-header { padding: 25px; border-bottom: 1px solid var(--border); }
.nav-list { flex: 1; overflow-y: auto; padding: 15px; }
.nav-item { 
    display: block; padding: 12px 20px; color: var(--text-secondary); 
    text-decoration: none; border-radius: 8px; font-size: 0.88rem; margin-bottom: 4px;
    line-height: 1.4; transition: all 0.2s;
}
.nav-item:hover { background: #f1f3f4; color: var(--text-primary); }
.nav-item.active { background: #e8f0fe; color: var(--accent); font-weight: 500; box-shadow: inset 4px 0 0 var(--accent); }

/* Main Area: Desktop */
.main { flex: 1; overflow-y: auto; padding: 40px 20px; }
.container { max-width: 850px; margin: 0 auto; }

/* Cards & Grid */
.card { background: var(--bg-card); border-radius: 12px; padding: 32px; margin-bottom: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.section-label { color: var(--accent); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; display: block; }
h1 { font-size: 2.5rem; font-weight: 300; margin: 0; color: var(--accent); }
h2 { font-size: 1.75rem; font-weight: 400; margin: 0 0 10px 0; }

.question-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 40px; }
.module-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 24px; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s; box-shadow: var(--shadow); }
.module-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); border-color: var(--accent); }

/* Expansion Sections (Prompt & Code) */
.expand-wrapper { position: relative; background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
.expand-content { padding: 20px; max-height: 120px; overflow: hidden; transition: max-height 0.5s ease; }
.expand-content.expanded { max-height: none; }
.show-more-bar { width: 100%; border: none; background: #fff; border-top: 1px solid #e0e0e0; padding: 12px; color: #1a73e8; cursor: pointer; font-weight: 600; font-family: inherit; }
#q-prompt { color: #5f6368; line-height: 1.6; margin: 0; font-size: 0.95rem; white-space: pre-wrap; }
pre[class*="language-"] { margin: 0; background: transparent; padding: 0; }

/* Gallery */
.image-gallery { display: flex; flex-direction: column; gap: 24px; margin-top: 20px; }
.analysis-img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* =============================================
   MOBILE OVERRIDES (Break Point: 768px)
   ============================================= */
@media (max-width: 768px) {
    body { flex-direction: column; }

    /* Convert Sidebar to Top Horizontal Nav */
    .sidebar { 
        width: 100%; 
        height: auto; 
        max-height: 180px; 
        border-right: none; 
        border-bottom: 1px solid var(--border); 
    }
    .sidebar-header { padding: 15px; text-align: center; }
    
    /* Make the 15 questions scroll horizontally for mobile efficiency */
    .nav-list { 
        display: flex; 
        flex-direction: row; 
        overflow-x: auto; 
        padding: 10px; 
        gap: 10px;
        -webkit-overflow-scrolling: touch; 
    }
    .nav-item { 
        flex-shrink: 0; 
        white-space: nowrap; 
        margin-bottom: 0; 
        padding: 8px 15px; 
        font-size: 0.8rem;
    }
    .nav-item.active { box-shadow: inset 0 -4px 0 var(--accent); }

    /* Adjust Content Spacing */
    .main { padding: 20px 15px; }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }
    .card { padding: 20px; }

    /* Adjust Hero Section for Home Page */
    header[style*="padding-bottom:40px"] { padding-bottom: 20px !important; }

    /* Grid becomes single column */
    .question-grid { grid-template-columns: 1fr; gap: 15px; }
}