:root {
    --primary: #38bdf8;
    /* Sky Blue */
    --primary-dark: #0284c7;
    --secondary: #818cf8;
    /* Indigo */
    --bg-dark: #0f172a;
    /* Slate 900 */
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --blueprint-grid: rgba(56, 189, 248, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    background-image: linear-gradient(var(--blueprint-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--blueprint-grid) 1px, transparent 1px);
    background-size: 30px 30px;
}

.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 2.5rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
}

.logo span {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nav-item {
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    border-color: rgba(56, 189, 248, 0.2);
    transform: translateX(5px);
}

.main-content {
    padding: 3rem;
    padding-bottom: 20rem;
    /* Added massive padding so last item is not stuck at bottom */
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.header h1 {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-muted);
    margin-bottom: 3rem;
}

.derivation-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.derivation-card:hover {
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.step {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    position: relative;
}

.step::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), transparent);
}

.step-label {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: block;
}

.math-block {
    background: rgba(15, 23, 42, 0.6);
    padding: 1.25rem;
    border-radius: 12px;
    margin: 1rem 0;
    font-size: 1.2rem;
    overflow-x: auto;
    border: 1px dashed rgba(56, 189, 248, 0.2);
}

.pro-tip {
    background: rgba(56, 189, 248, 0.1);
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
}

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}