:root {
    --bg-color: #0f172a;
    --container-bg: #1e293b;
    --text-color: #f8fafc;
    --accent-color: #38bdf8;
    --accent-hover: #0284c7;
    --sin-color: #fb7185;
    --cos-color: #34d399;
    --combined-color: #facc15;
    --grid-color: rgba(248, 250, 252, 0.1);
    --panel-bg: rgba(0, 0, 0, 0.2);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--sin-color), var(--cos-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.container {
    background-color: var(--container-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    width: 100%;
    /* Made maximum width smaller so it takes up less space */
    max-width: 900px;
}

.graphs-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.graph-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #0f172a;
    padding: 15px;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.panel-controls {
    display: flex;
    /* flex-wrap: wrap; */
    align-items: center;
    gap: 8px;
}

select,
input[type="number"] {
    background-color: #1e293b;
    color: var(--text-color);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.9rem;
    outline: none;
}

select:focus,
input[type="number"]:focus {
    border-color: var(--accent-color);
}

input[type="number"] {
    width: 30px;
}

input[type="range"] {
    flex-grow: 1;
    accent-color: var(--accent-color);
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #cbd5e1;
}

.canvas-container {
    position: relative;
    width: 100%;
    /* Use simpler aspect ratio so squares don't visually explode horizontally */
    aspect-ratio: 2 / 1;
    max-height: 100px;
}

.canvas-container.wide {
    aspect-ratio: 2 / 1;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#generateBtn {
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    background: var(--accent-color);
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

#generateBtn:hover {
    background: var(--accent-hover);
}

#combinedPanelContainer,
#integralPanelContainer {
    display: none;
}

.text-sm {
    display: none;
}

.text-lg {
    display: block;
}

@media (max-width: 850px) {
    .container {
        padding: 10px;
    }

    .graph-panel {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    select,
    input[type="number"] {
        font-size: 0.8rem;
        padding: 4px 6px;
    }

    input[type="number"] {
        width: 25px;
    }

    .equation-label {
        font-size: 0.95rem;
    }
}

@media (max-width: 600px) {
    .text-lg {
        display: none;
    }

    .text-sm {
        display: block;
    }

    input[type="range"] {
        display: none;
    }
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 900px;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
    border: 2px solid transparent;
    border-bottom: 2px solid #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.tab-btn:hover {
    color: #f8fafc;
    border-bottom-color: #94a3b8;
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-content {
    display: none;
    width: 100%;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Mathematical Proofs Styles */
details.math-proof {
    background: var(--panel-bg);
    border: 1px solid #334155;
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

details.math-proof summary {
    padding: 15px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #f8fafc;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    outline: none;
}

details.math-proof summary::-webkit-details-marker {
    display: none;
}

details.math-proof summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--accent-color);
    transition: transform 0.3s ease;
}

details.math-proof[open] summary::after {
    content: '−';
    transform: rotate(180deg);
}

.proof-content {
    padding: 20px;
    color: #cbd5e1;
    line-height: 1.6;
    border-top: 1px solid #334155;
}

.proof-content code {
    background: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Additional Utility Classes extracted from inline CSS */
.btn-primary {
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 8px;
    border: none;
    background: var(--accent-color);
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
}

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

.btn-success {
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    background: #10b981;
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-success:hover {
    background: #059669;
}

/* --- Extracted Inline Styles --- */

.equation-label {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    font-style: italic;
}

.equations-list {
    text-align: left;
    line-height: 2;
    max-width: 600px;
    margin: 0 auto;
}

.tutorial-container {
    max-width: 800px;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    margin-top: 20px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.text-center-mt20 {
    text-align: center;
    margin-top: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.panel-label {
    text-align: center;
    color: #fff;
    font-weight: 600;
    /* margin-bottom: 10px; */
}

.panel-label.small-mb {
    margin-bottom: 5px;
}

.integral-result {
    text-align: center;
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: 600;
    /* margin-bottom: 15px; */
}

/* Proofs styles */
.proof-title {
    text-align: center;
    margin-top: 0;
}

.proof-subtitle {
    color: #94a3b8;
    text-align: center;
    margin-bottom: 25px;
}

.equations-overview {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.1rem;
    line-height: 2;
    border: 1px solid #334155;
    overflow-x: auto;
}

.equations-overview h3 {
    margin-top: 0;
    color: #f8fafc;
    font-size: 1.2rem;
}

.math-equation {
    text-align: center;
    font-style: italic;
    overflow-x: auto;
}