:root {
    --bg-color: #ffffff;
    --beamer-main: #3333b2; /* classic beamer blue */
    --beamer-bg: #f8f8fb;
    --beamer-block-title: #3333b2;
    --beamer-block-bg: #eaeaea;
    --text-primary: #000000;
    --text-secondary: #333333;
    --border-color: #cccccc;
    --accent: #3333b2;
    --accent-hover: #1e1e8c;
    --matrix-bg: #ffffff;
    --cell-bg: #ffffff;
    --highlight: rgba(255, 255, 0, 0.4);
}

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

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

.container {
    display: flex;
    height: 100vh;
    padding: 0;
    gap: 0;
}

.sidebar {
    width: 320px;
    background-color: #e6e6f0; /* Light gray-blue, typical for Beamer sidebars */
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    border-radius: 0;
}

.left-sidebar {
    border-right: 2px solid var(--beamer-main);
}

.right-sidebar {
    border-left: 2px solid var(--beamer-main);
}

.sidebar h1 {
    font-size: 1.4rem;
    margin-bottom: 2rem;
    font-weight: bold;
    color: var(--beamer-main);
    text-align: center;
    border-bottom: 1px solid var(--beamer-main);
    padding-bottom: 0.8rem;
    background: none;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: currentcolor;
}

#step-description {
    flex: 1;
}

#step-description h2 {
    font-size: 1.25rem;
    color: var(--beamer-main);
    margin-bottom: 1rem;
    font-weight: bold;
}

#step-text {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* Rationale block — was inline styles */
.rationale-block {
    display: none;
    background: #fdf6e3;
    border: 1px solid #eee8d5;
    border-left: 4px solid #b58900;
    padding: 0.8rem;
    margin-bottom: 1.5rem;
    color: #000;
    font-size: 0.95rem;
}

.rationale-label {
    color: #b58900;
}

.formula {
    background: var(--beamer-block-bg);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--beamer-main);
    font-family: 'Computer Modern Serif', 'Times New Roman', serif;
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #000;
}

/* Metrics panel — was inline styles */
.metrics-panel {
    border-top: 2px solid var(--beamer-main);
    padding-top: 1rem;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    font-size: 0.85rem;
}

.metric-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 0.2rem;
}

.metric-box-last {
    border-bottom: none;
}

.metric-label {
    color: var(--beamer-main);
}

.metric-value-group {
    text-align: right;
}

.metric-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.metric-eq {
    font-size: 0.8rem;
    color: #555;
}

.controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

button {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #888;
    border-radius: 2px;
    background: #f0f0f0;
    color: #000;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.15);
}

button:hover:not(:disabled) {
    background: #e0e0e0;
}

button:disabled {
    background: #e0e0e0;
    color: #999;
    box-shadow: none;
    cursor: not-allowed;
    border-color: #ccc;
}

/* Primary button styling for 'Next' */
#btn-next {
    background: var(--beamer-main);
    color: white;
    border-color: var(--beamer-main);
}
#btn-next:hover:not(:disabled) {
    background: var(--accent-hover);
}

.variants {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.variants h4 {
    color: var(--beamer-main);
    font-size: 0.95rem;
    text-transform: none;
    font-weight: bold;
    margin-bottom: 0.5rem;
    margin-top: 0.8rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.2rem;
}

.variants h4:first-child {
    margin-top: 0;
}

.variants button {
    background: transparent;
    border: none;
    text-align: left;
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    box-shadow: none;
    border-radius: 0;
}

.variants button.active {
    background: #d4d4eb;
    font-weight: bold;
    color: var(--beamer-main);
    border-left: 4px solid var(--beamer-main);
}

.matrix-canvas {
    flex: 1;
    padding: 2rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background-color: var(--bg-color);
}

.waiting {
    color: var(--beamer-main);
    font-size: 1.2rem;
    font-style: italic;
}

/* Error message styling */
.error-msg {
    color: #cc3333;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Visualization Styles */
.vis-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.matrix-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.matrix-label {
    font-family: inherit;
    font-weight: bold;
    color: var(--beamer-main);
    font-size: 1rem;
}

.matrix {
    display: grid;
    gap: 2px;
    background: var(--matrix-bg);
    padding: 8px;
    position: relative;
    border: none;
}

/* Brackets for matrix like LaTeX \begin{bmatrix} */
.matrix::before, .matrix::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    border: 2px solid black;
}
.matrix::before { left: 0; border-right: none; }
.matrix::after { right: 0; border-left: none; }

.cell {
    background: var(--cell-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Computer Modern Serif", "Times New Roman", serif;
    font-size: 1.1rem;
    color: black;
    width: 50px;
    height: 40px;
    border-radius: 0;
    transition: background-color 0.2s;
}

.cell.highlight {
    background: var(--highlight);
    font-weight: bold;
    transform: none;
    box-shadow: none;
}

.operator {
    font-family: "Computer Modern Serif", "Times New Roman", serif;
    font-size: 1.5rem;
    color: black;
    margin: 0 0.3rem;
}

/* Responsive breakpoints */
@media (max-width: 1100px) {
    .sidebar {
        width: 260px;
        padding: 1rem;
    }
}

@media (max-width: 860px) {
    .container {
        flex-direction: column;
        overflow: auto;
    }
    .sidebar {
        width: 100%;
        border-right: none !important;
        border-left: none !important;
        border-bottom: 2px solid var(--beamer-main);
    }
    .matrix-canvas {
        min-height: 50vh;
    }
    body {
        overflow: auto;
    }
}
