/* ========================================
   CNN Calculator - Style Sheet
   Theme: Dark Technical / Scientific
   Font: JetBrains Mono + Syne
======================================== */

/* ==================== LIGHT THEME ==================== */
[data-theme="light"] {
    --bg:        #f0f4fa;
    --bg2:       #ffffff;
    --bg3:       #e8edf6;
    --bg4:       #dce3f0;
    --border:    #c4cedf;
    --border2:   #adb9ce;
    --text:      #1a2340;
    --text2:     #445070;
    --text3:     #7a8faa;
    --accent:    #009e7f;
    --accent2:   #0075cc;
    --accent3:   #cc3333;
    --accent4:   #a07000;
    --glow:      rgba(0,158,127,0.1);
    --glow2:     rgba(0,117,204,0.08);
}
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .navbar { background: rgba(240,244,250,0.96); border-color: var(--border); }
[data-theme="light"] .matrix-cell { background: #fff; }
[data-theme="light"] .kernel-cell { background: rgba(0,117,204,0.06); }
[data-theme="light"] .conv-panel,
[data-theme="light"] .conv-results { background: var(--bg2); }
[data-theme="light"] .conv-center { background: var(--bg3); }
[data-theme="light"] .fc-result-card { background: var(--bg3); }
[data-theme="light"] .bp-chain-box,
[data-theme="light"] .fc-weights-grid,
[data-theme="light"] .fc-param-row,
[data-theme="light"] .sc-calc,
[data-theme="light"] .bp-bias-row { background: var(--bg4); }
[data-theme="light"] .btn-sm { background: var(--bg3); }
[data-theme="light"] .form-select,
[data-theme="light"] .fc-scalar-input,
[data-theme="light"] .fc-weight-inp { background: var(--bg4); border-color: var(--border); color: var(--text); }
[data-theme="light"] .size-control button,
[data-theme="light"] .size-control input { background: var(--bg3); color: var(--text); }
[data-theme="light"] .dim-preview { background: var(--bg3); }
[data-theme="light"] .flatten-out { background: var(--bg4); color: var(--text2); }
[data-theme="light"] .footer { background: var(--bg2); }
[data-theme="light"] .steps-inner { background: var(--bg2); }
[data-theme="light"] .step-item { background: var(--bg3); }
[data-theme="light"] .md-cell { color: var(--text); }
[data-theme="light"] .sc-table th { background: var(--bg4); }
[data-theme="light"] .panel-section { border-color: var(--border); }
[data-theme="light"] .result-section { border-color: var(--border); }
[data-theme="light"] .error-msg { background: rgba(204,51,51,0.08); }

/* Theme transition (smooth but fast) */
body, .navbar, .conv-panel, .conv-center, .conv-results, .conv-main,
.matrix-cell, .kernel-cell, .btn-sm, .form-select, .fc-scalar-input,
.fc-weight-inp, .size-control button, .size-control input, .dim-preview,
.flatten-out, .footer, .panel-section, .fc-result-card, .bp-chain-box,
.sc-calc, .fc-weights-grid, .fc-param-row, .bp-bias-row, .md-cell {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.15s ease, box-shadow 0.25s ease;
}

/* Theme toggle button */
.theme-toggle {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg4); color: var(--accent); border-color: var(--accent); }

:root {
    --bg:        #0a0c10;
    --bg2:       #0f1117;
    --bg3:       #161b24;
    --bg4:       #1e2533;
    --border:    #2a3244;
    --border2:   #364054;
    --text:      #d4ddf0;
    --text2:     #8899bb;
    --text3:     #5a6a88;
    --accent:    #00d2aa;
    --accent2:   #0099ff;
    --accent3:   #ff6b6b;
    --accent4:   #ffcc44;
    --glow:      rgba(0,210,170,0.15);
    --glow2:     rgba(0,153,255,0.12);
    --font-mono: 'JetBrains Mono', monospace;
    --font-ui:   'Syne', sans-serif;
    --radius:    8px;
    --radius2:   12px;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== NAVBAR ==================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 2rem;
    height: 60px;
    background: rgba(10,12,16,0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.brand-icon { color: var(--accent); font-size: 1.4rem; }
.brand-text { color: var(--text); }
.brand-text .accent { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.nav-link {
    text-decoration: none;
    color: var(--text2);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}

.nav-link:hover { color: var(--text); background: var(--bg3); }
.nav-link.active { color: var(--accent); background: rgba(0,210,170,0.1); }

.nav-mobile-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer; }

.mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
}
.mobile-menu a { padding: 0.75rem 0.5rem; color: var(--text2); text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--border); }
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu.open { display: flex; }
.mobile-menu .mobile-group-label {
    padding: 0.55rem 0.5rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text3);
    border-bottom: none;
}
.mobile-menu .mobile-sub-link {
    padding: 0.55rem 0.5rem 0.55rem 1.25rem;
    font-size: 0.83rem;
    color: var(--text2);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    display: block;
}
.mobile-menu .mobile-sub-link:last-child { border-bottom: none; }
.mobile-menu .mobile-sub-link:hover { color: var(--accent); }

/* ==================== DROPDOWN NAV ==================== */
.nav-dropdown {
    position: relative;
}
.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text2);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    letter-spacing: 0.01em;
    font-family: var(--font-ui);
}
.nav-dropdown-btn:hover { color: var(--text); background: var(--bg3); }
.nav-dropdown-btn.active { color: var(--accent); background: rgba(0,210,170,0.1); }
.nav-dropdown-caret {
    font-size: 0.6rem;
    opacity: 0.7;
    transition: transform 0.2s;
}
.nav-dropdown:hover .nav-dropdown-caret { transform: rotate(180deg); }

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius2);
    padding: 0.5rem;
    min-width: 200px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    transform: translateX(-50%) translateY(-6px);
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
[data-theme="light"] .nav-dropdown-menu {
    background: var(--bg2);
    border-color: var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text2);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
.nav-dropdown-item:hover { color: var(--text); background: var(--bg3); }
.nav-dropdown-item.active { color: var(--accent); background: rgba(0,210,170,0.08); }
.nav-dropdown-item-icon {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    color: var(--accent);
}
.nav-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.35rem 0;
}
.nav-dropdown-label {
    padding: 0.3rem 0.75rem 0.1rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text3);
}

.nav-dropdown-item-icon.rnn { color: var(--accent2); }
.nav-dropdown-btn.rnn-active { color: var(--accent2); background: rgba(0,153,255,0.1); }

@media (max-width: 768px) {
    .nav-links { display: none; }
    .nav-mobile-toggle { display: block; margin-left: auto; }
}

/* ==================== MAIN ==================== */
.main-content { flex: 1; padding: 0; }

/* ==================== HERO ==================== */
.hero {
    position: relative;
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 4rem 2rem;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(0,210,170,0.07) 0%, transparent 60%),
                radial-gradient(ellipse 60% 40% at 80% 20%, rgba(0,153,255,0.05) 0%, transparent 50%);
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.3;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 0%, transparent 100%);
}

.hero-content {
    position: relative;
    text-align: center;
    max-width: 700px;
}

.hero-badge {
    display: inline-block;
    background: rgba(0,210,170,0.1);
    border: 1px solid rgba(0,210,170,0.3);
    color: var(--accent);
    padding: 0.35rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.6s ease;
}

.hero-title {
    font-family: var(--font-ui);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: var(--text);
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.7s ease 0.1s both;
}

.hero-accent { color: var(--accent); display: block; }

.hero-desc {
    color: var(--text2);
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto 2.5rem;
    animation: fadeInUp 0.7s ease 0.2s both;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    animation: fadeInUp 0.7s ease 0.3s both;
}

.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: #000;
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,210,170,0.3); }

.btn-outline {
    display: inline-block;
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ==================== FEATURES ==================== */
.features-section {
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

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

.feature-card {
    display: block;
    text-decoration: none;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 2rem;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.feature-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,210,170,0.1); }
.feature-card:hover::before { opacity: 1; }

.fc-icon { font-size: 2rem; color: var(--accent); margin-bottom: 1rem; }

.feature-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: var(--text2);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.fc-list {
    list-style: none;
    margin-bottom: 1.5rem;
}
.fc-list li {
    font-size: 0.8rem;
    color: var(--text3);
    font-family: var(--font-mono);
    padding: 0.2rem 0;
    padding-left: 1rem;
    position: relative;
}
.fc-list li::before { content: '→'; position: absolute; left: 0; color: var(--accent); }

.fc-btn { font-size: 0.8rem; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }

/* ==================== STATS ==================== */
.info-section {
    background: var(--bg2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 800px;
    margin: 0 auto;
    gap: 1rem;
    text-align: center;
}

@media (max-width: 600px) { .info-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-num {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    font-family: var(--font-mono);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text3);
    font-weight: 600;
    margin-top: 0.25rem;
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    padding: 2.5rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
}

.page-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.page-sub {
    color: var(--text2);
    font-size: 0.9rem;
}

/* ==================== CONVOLUTION LAYOUT ==================== */
.conv-layout {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 0;
    min-height: calc(100vh - 200px);
    align-items: start;
}

/* The right column: matrices on top, results below */
.conv-main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 200px);
}

@media (max-width: 1000px) {
    .conv-layout { grid-template-columns: 1fr; }
    .conv-main { min-height: auto; }
}

/* ==================== PANEL ==================== */
.conv-panel {
    background: var(--bg2);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
    align-self: start;
}

.panel-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.panel-section:last-of-type { border-bottom: none; }

.ps-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ps-icon { color: var(--accent); font-size: 1.1rem; }
.ps-header h3 { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.05em; color: var(--text); text-transform: uppercase; }

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.form-row label {
    font-size: 0.8rem;
    color: var(--text2);
    font-weight: 600;
    min-width: 70px;
}

.size-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    overflow: hidden;
}

.size-control button {
    background: var(--bg3);
    border: none;
    color: var(--text);
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: background 0.2s;
    font-family: var(--font-mono);
}
.size-control button:hover { background: var(--bg4); color: var(--accent); }

.size-control input {
    width: 44px;
    text-align: center;
    background: var(--bg3);
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.25rem;
    height: 28px;
}

.form-select, .form-input {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: var(--font-ui);
    flex: 1;
    cursor: pointer;
    transition: border-color 0.2s;
}
.form-select:focus, .form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row-btns {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.btn-sm {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}
.btn-sm:hover { background: var(--bg4); color: var(--accent); border-color: var(--accent); }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text2);
}
.checkbox-row input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
}

.btn-calc {
    width: 100%;
    background: var(--accent);
    border: none;
    color: #000;
    padding: 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-calc:hover { background: #00e8bb; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,210,170,0.3); }
.btn-calc:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.dim-preview {
    margin-top: 1rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
}
.dim-label { font-size: 0.7rem; color: var(--text3); font-family: var(--font-mono); letter-spacing: 0.08em; margin-bottom: 0.4rem; }
.dim-formula { font-size: 0.7rem; color: var(--text2); font-family: var(--font-mono); margin-bottom: 0.3rem; }
.dim-result { font-size: 1.1rem; font-weight: 800; color: var(--accent); font-family: var(--font-mono); }

/* ==================== MATRICES ==================== */
.conv-center {
    padding: 2rem;
    background: var(--bg);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
}

.matrix-section { }
.matrix-section.small { max-width: 220px; }

.matrix-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text3);
    font-family: var(--font-mono);
    margin-bottom: 0.75rem;
}

.matrix-grid {
    display: grid;
    gap: 3px;
    width: fit-content;
}

.matrix-cell {
    width: 44px;
    height: 44px;
    text-align: center;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    transition: border-color 0.15s, background 0.15s;
}
.matrix-cell:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg4);
}

.kernel-cell {
    background: rgba(0,153,255,0.08);
    border-color: rgba(0,153,255,0.25);
}
.kernel-cell:focus { border-color: var(--accent2); background: rgba(0,153,255,0.15); }

.conv-arrow-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.conv-op-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.op-symbol {
    font-size: 2rem;
    color: var(--accent);
    font-weight: 300;
    opacity: 0.7;
}

/* ==================== RESULTS ==================== */
.conv-results {
    background: var(--bg2);
    border-top: 2px solid var(--border);
    padding: 2rem;
    /* Full width below matrices — no longer a fixed-height side column */
    width: 100%;
    /* Multi-column grid for result cards on large screens */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    align-content: start;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    color: var(--text3);
    text-align: center;
    gap: 0.75rem;
    grid-column: 1 / -1;  /* span full width */
}
.ph-icon { font-size: 2.5rem; opacity: 0.3; }
.result-placeholder p { font-size: 0.85rem; line-height: 1.5; }

.result-section {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 1.1rem;
}

/* FC setup and steps button span full width */
.fc-setup-section,
.btn-steps {
    grid-column: 1 / -1;
}

.rs-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    font-family: var(--font-mono);
    margin-bottom: 0.6rem;
}

.rs-meta {
    font-size: 0.72rem;
    color: var(--text3);
    font-family: var(--font-mono);
    margin-bottom: 0.6rem;
}

.matrix-display {
    display: grid;
    gap: 2px;
    width: fit-content;
    max-width: 100%;
    overflow: auto;
}

.md-cell {
    min-width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.1s;
    cursor: default;
}
.md-cell:hover { transform: scale(1.1); z-index: 1; position: relative; }

.flatten-out {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text2);
    background: var(--bg3);
    padding: 0.75rem;
    border-radius: var(--radius);
    word-break: break-all;
    line-height: 1.6;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.btn-steps {
    background: none;
    border: 1px solid var(--border2);
    color: var(--text2);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}
.btn-steps:hover { border-color: var(--accent); color: var(--accent); }

.error-msg {
    background: rgba(255,107,107,0.1);
    border: 1px solid rgba(255,107,107,0.3);
    color: var(--accent3);
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
}

/* ==================== STEPS MODAL ==================== */
.steps-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.steps-inner {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius2);
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.steps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.steps-header h3 { font-size: 1rem; font-weight: 700; color: var(--text); }
.steps-header button {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 1.2rem;
    cursor: pointer;
}

#stepsContent {
    overflow-y: auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step-item {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.step-pos {
    font-size: 0.78rem;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.4rem;
}

.step-detail {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text2);
    font-family: var(--font-mono);
    margin-bottom: 0.4rem;
}

.step-calc {
    font-size: 0.72rem;
    color: var(--text3);
    font-family: var(--font-mono);
    word-break: break-all;
}

.steps-more {
    color: var(--text3);
    font-size: 0.8rem;
    text-align: center;
    padding: 0.5rem;
}

/* ==================== IMAGE PAGE ==================== */
.img-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: calc(100vh - 200px);
}

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

.img-main {
    padding: 2rem;
    background: var(--bg);
    overflow: auto;
}

.upload-zone {
    border: 2px dashed var(--border2);
    border-radius: var(--radius2);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--glow);
}

.uz-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.5rem 1rem;
    text-align: center;
}

.uz-icon { font-size: 2rem; color: var(--accent); opacity: 0.5; }
.uz-content p { font-size: 0.82rem; color: var(--text2); font-weight: 600; }
.uz-content small { font-size: 0.72rem; color: var(--text3); font-family: var(--font-mono); }

.image-preview {
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.image-preview img {
    width: 100%;
    max-height: 160px;
    object-fit: contain;
    background: var(--bg3);
    display: block;
}

.img-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.irg-item h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text2);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.irg-item.full-width { grid-column: 1 / -1; }

.result-img {
    width: 100%;
    max-width: 180px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
}

.dim-note {
    font-size: 0.72rem;
    color: var(--text3);
    font-family: var(--font-mono);
    margin-top: 0.4rem;
}

.hm-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hm-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.45rem 0.7rem;
}

.hm-toolbar-row1 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hm-dim-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0,210,170,0.1);
    border: 1px solid rgba(0,210,170,0.25);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    letter-spacing: 0.04em;
}

.hm-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.hm-zoom-slider {
    flex: 1;
    min-width: 80px;
    max-width: 160px;
    accent-color: var(--accent);
    cursor: pointer;
    height: 4px;
}

.hm-zoom-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text2);
    min-width: 36px;
    text-align: center;
}

.hm-btn {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text2);
    width: 26px;
    height: 26px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.hm-btn:hover { background: var(--bg4); color: var(--accent); border-color: var(--accent); }

.hm-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--text3);
    cursor: pointer;
    user-select: none;
}
.hm-toggle-label input { accent-color: var(--accent); }

.hm-scroll-box {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 520px;
    cursor: grab;
    background: var(--bg3);
    padding: 3px;
}
.hm-scroll-box:active { cursor: grabbing; }

.heatmap {
    display: grid;
    gap: 1px;
    width: fit-content;
}

.hm-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-family: var(--font-mono);
    border-radius: 1px;
    cursor: crosshair;
    font-weight: 600;
    transition: transform 0.1s;
    /* height auto-follows grid row */
    aspect-ratio: 1;
}
.hm-cell:hover { transform: scale(1.8); z-index: 10; position: relative; box-shadow: 0 0 6px rgba(0,0,0,0.6); }

.hm-canvas-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent2);
    background: rgba(0,153,255,0.1);
    border: 1px solid rgba(0,153,255,0.3);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
}
.hm-canvas-tip {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text3);
    font-style: italic;
}
.hm-hover-tip {
    display: none;
    position: absolute;
    background: var(--bg4);
    border: 1px solid var(--border2);
    border-radius: 5px;
    padding: 0.25rem 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text);
    pointer-events: none;
    white-space: nowrap;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
[data-theme="light"] .hm-hover-tip { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

.hm-btn-excel {
    background: rgba(0, 120, 50, 0.15);
    border-color: rgba(0, 180, 80, 0.4);
    color: #00c853;
    font-size: 0.7rem;
    width: auto;
    padding: 0 0.6rem;
    gap: 0.25rem;
    font-family: var(--font-ui);
    font-weight: 700;
    letter-spacing: 0.02em;
}
.hm-btn-excel:hover {
    background: rgba(0, 120, 50, 0.3);
    border-color: #00c853;
    color: #00c853;
}
[data-theme="light"] .hm-btn-excel {
    background: rgba(0, 120, 50, 0.08);
    color: #00843a;
    border-color: rgba(0, 130, 60, 0.35);
}

/* ==================== CONCEPTS ==================== */
.concepts-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.concept-category {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    overflow: hidden;
    transition: border-color 0.2s;
}
.concept-category.open { border-color: var(--accent); }

.cc-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.cc-header:hover { background: var(--bg3); }

.cc-icon {
    width: 32px;
    height: 32px;
    background: rgba(0,210,170,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 700;
    flex-shrink: 0;
}

.cc-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

.cc-toggle {
    color: var(--text3);
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.cc-body {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.concept-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.2s;
    position: relative;
}
.concept-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.concept-card.highlight { border-color: rgba(0,210,170,0.3); background: rgba(0,210,170,0.05); }

.ccard-icon {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.concept-card h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.concept-card p {
    font-size: 0.8rem;
    color: var(--text2);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.ccard-formula {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    background: rgba(0,210,170,0.08);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border-left: 2px solid var(--accent);
}

.ccard-list {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text3);
    margin-bottom: 0.5rem;
}

.ccard-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent2);
    background: rgba(0,153,255,0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.activation-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    overflow-x: auto;
}

.at-row {
    display: grid;
    grid-template-columns: 130px 200px 100px 1fr 1fr;
    gap: 0;
}

.at-row.at-head {
    background: var(--bg4);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text3);
}

.at-row:not(.at-head) { border-top: 1px solid var(--border); }
.at-row:not(.at-head):hover { background: var(--bg3); }

.at-row span {
    padding: 0.7rem 0.9rem;
    font-size: 0.8rem;
    color: var(--text2);
    font-family: var(--font-mono);
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
}
.at-row span:last-child { border-right: none; }

.mono { font-family: var(--font-mono); font-size: 0.72rem; }

.coming-soon-section {
    background: var(--bg2);
    border: 1px dashed var(--border2);
    border-radius: var(--radius2);
    padding: 2.5rem;
    text-align: center;
}

.cs-icon { font-size: 2.5rem; color: var(--accent); opacity: 0.3; margin-bottom: 1rem; }
.coming-soon-section h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.coming-soon-section p { color: var(--text2); font-size: 0.875rem; margin-bottom: 1.5rem; }

.cs-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.cs-pills span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text3);
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 0.3rem 0.7rem;
    border-radius: 100px;
}

/* ==================== CNN PIPELINE ==================== */
.cnn-pipeline-section {
    background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
    padding: 3rem 2rem 2rem;
    margin-bottom: 0;
}

.pipeline-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.pipeline-badge {
    display: inline-block;
    background: rgba(0,210,170,0.1);
    border: 1px solid rgba(0,210,170,0.25);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 0.3rem 1rem;
    border-radius: 100px;
    margin-bottom: 1rem;
}

.pipeline-title {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.pipeline-sub {
    color: var(--text2);
    font-size: 0.875rem;
}

/* === Flow === */
.pipeline-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.pf-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 1rem 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px;
    position: relative;
    user-select: none;
}

.pf-step:hover {
    border-color: var(--border2);
    background: var(--bg4);
    transform: translateY(-2px);
}

.pf-step.active {
    background: rgba(0,210,170,0.08);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(0,210,170,0.15);
    transform: translateY(-3px);
}

.pf-step-number {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text3);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.pf-step.active .pf-step-number { color: var(--accent); }

.pf-step-icon {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text2);
}

.pf-step.active .pf-step-icon { color: var(--accent); }

.pf-step-label {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text);
    white-space: nowrap;
}

.pf-step-sub {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text3);
    white-space: nowrap;
}

.pf-step.active .pf-step-sub { color: var(--accent); opacity: 0.7; }

.pf-arrow {
    color: var(--border2);
    font-size: 1.2rem;
    font-weight: 300;
    padding: 0 0.1rem;
    flex-shrink: 0;
}

/* === Detail Panels === */
.pipeline-detail-container {
    position: relative;
}

.pipeline-detail {
    display: none;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    overflow: hidden;
    margin-bottom: 0.5rem;
    animation: pipeDetailIn 0.25s ease;
}

.pipeline-detail.visible { display: block; }

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

.pd-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.pd-left {
    padding: 2rem;
    border-right: 1px solid var(--border);
}

.pd-right {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pd-step-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.pd-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 1.25rem;
    line-height: 1.3;
}

.pd-en {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text3);
    font-family: var(--font-mono);
}

.pd-process, .pd-purpose {
    color: var(--text2);
    font-size: 0.875rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.pd-label {
    color: var(--accent);
    font-weight: 700;
    margin-right: 0.25rem;
}

.pd-formula-box {
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.pd-formula-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text3);
    font-weight: 600;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.pd-formula {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--accent4);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.pd-formula-params {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pd-formula-params span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text3);
    background: var(--bg3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* === Conv Visual === */
.pd-visual.conv-visual {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cv-grid { text-align: center; }
.cv-label { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text3); margin-bottom: 0.3rem; }
.cv-cells { display: grid; gap: 2px; }
.cv-cell {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg4);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text2);
    border-radius: 2px;
}
.cv-highlight { background: rgba(0,153,255,0.12); border-color: rgba(0,153,255,0.3); }
.cv-kernel-cell { color: var(--accent4); background: rgba(255,204,68,0.08); border-color: rgba(255,204,68,0.2); }
.cv-out-cell { color: var(--accent); }
.cv-out-active { background: rgba(0,210,170,0.12); border-color: var(--accent); }
.cv-op { color: var(--text3); font-size: 1.1rem; padding: 0 0.2rem; }

.pd-cta-btn {
    display: inline-block;
    margin-top: auto;
    background: rgba(0,210,170,0.1);
    border: 1px solid rgba(0,210,170,0.25);
    color: var(--accent);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}
.pd-cta-btn:hover { background: rgba(0,210,170,0.18); border-color: var(--accent); }

/* === ReLU Demo === */
.pd-relu-demo { display: flex; flex-direction: column; gap: 1rem; }
.relu-chart { background: var(--bg4); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem; }
.relu-chart svg { width: 100%; height: auto; display: block; }

.relu-before-after {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.rba-col { flex: 1; }
.rba-title { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text3); margin-bottom: 0.4rem; text-align: center; }
.rba-vals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}
.rba-vals span {
    display: flex; align-items: center; justify-content: center;
    height: 26px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    border-radius: 3px;
    border: 1px solid var(--border);
}
.rba-vals span.neg { color: var(--accent3); background: rgba(255,107,107,0.1); border-color: rgba(255,107,107,0.2); }
.rba-vals span.pos { color: var(--accent); background: rgba(0,210,170,0.08); border-color: rgba(0,210,170,0.2); }
.rba-vals span.zero { color: var(--text3); background: var(--bg4); }
.rba-arrow { color: var(--accent); font-size: 1.2rem; font-weight: 700; }

/* === Pooling Demo === */
.pd-pooling-demo {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.pool-grid { text-align: center; }
.pg-label { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text3); margin-bottom: 0.4rem; }
.pg-cells {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}
.pg-out { grid-template-columns: repeat(2, 1fr); }
.pg-cells span {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    border-radius: 3px;
    border: 1px solid var(--border);
    color: var(--text2);
    background: var(--bg4);
}
.pool-h1 { background: rgba(0,153,255,0.07) !important; border-color: rgba(0,153,255,0.15) !important; }
.pool-h2 { background: rgba(0,210,170,0.07) !important; border-color: rgba(0,210,170,0.15) !important; }
.pool-h3 { background: rgba(255,204,68,0.07) !important; border-color: rgba(255,204,68,0.15) !important; }
.pool-h4 { background: rgba(255,107,107,0.07) !important; border-color: rgba(255,107,107,0.15) !important; }
.pool-max { font-weight: 700; filter: brightness(1.5); }
.pool-r1 { background: rgba(0,153,255,0.15) !important; border-color: rgba(0,153,255,0.4) !important; color: #99ccff !important; font-weight: 700; }
.pool-r2 { background: rgba(0,210,170,0.15) !important; border-color: rgba(0,210,170,0.4) !important; color: var(--accent) !important; font-weight: 700; }
.pool-r3 { background: rgba(255,204,68,0.15) !important; border-color: rgba(255,204,68,0.4) !important; color: var(--accent4) !important; font-weight: 700; }
.pool-r4 { background: rgba(255,107,107,0.15) !important; border-color: rgba(255,107,107,0.4) !important; color: var(--accent3) !important; font-weight: 700; }
.pool-arrow { color: var(--accent); font-size: 1.5rem; }

/* === Flatten Demo === */
.pd-flatten-demo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.flatten-matrix { text-align: center; }
.fm-label { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text3); margin-bottom: 0.4rem; }
.fm-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}
.fm-grid span, .fv-cells span {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.fm-c1 { background: rgba(0,153,255,0.12); border-color: rgba(0,153,255,0.3) !important; color: #99ccff; }
.fm-c2 { background: rgba(0,210,170,0.12); border-color: rgba(0,210,170,0.3) !important; color: var(--accent); }
.fm-c3 { background: rgba(255,204,68,0.12); border-color: rgba(255,204,68,0.3) !important; color: var(--accent4); }
.fm-c4 { background: rgba(255,107,107,0.12); border-color: rgba(255,107,107,0.3) !important; color: var(--accent3); }

.flatten-arrow { text-align: center; }
.fa-line { width: 2px; height: 20px; background: var(--border2); margin: 0 auto; }
.fa-label { font-family: var(--font-mono); font-size: 0.65rem; color: var(--accent); margin: 0.3rem 0; }

.flatten-vector { text-align: center; }
.fv-label { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text3); margin-bottom: 0.4rem; }
.fv-cells { display: flex; gap: 4px; justify-content: center; }

/* === FC Demo === */
.pd-fc-demo {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 0.75rem;
    overflow: hidden;
}
.fc-layer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.fc-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--text3);
    margin-bottom: 0.25rem;
    text-align: center;
    white-space: nowrap;
}
.fc-node {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border2);
    background: var(--bg3);
}
.fc-node-active { border-color: var(--accent); background: rgba(0,210,170,0.15); }
.fc-node-out { border-color: var(--accent2); background: rgba(0,153,255,0.15); width: 16px; height: 16px; }
.fc-connections {
    flex: 1;
    height: 120px;
    min-width: 50px;
}
.fc-connections svg { width: 100%; height: 100%; }

/* === Softmax Demo === */
.pd-softmax-demo {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.softmax-row { }
.sm-label { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text3); margin-bottom: 0.4rem; }
.sm-vals { display: flex; gap: 0.5rem; }
.sm-item {
    flex: 1;
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.5rem;
    text-align: center;
}
.sm-class { display: block; font-size: 0.7rem; color: var(--text2); margin-bottom: 0.2rem; }
.sm-logit { font-family: var(--font-mono); font-size: 0.875rem; font-weight: 700; color: var(--accent4); }
.sm-arrow { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); font-weight: 600; text-align: center; }
.sm-probs { display: flex; flex-direction: column; gap: 0.4rem; }
.sm-prob-item { display: flex; align-items: center; gap: 0.5rem; }
.sm-prob-bar {
    height: 8px;
    background: var(--accent);
    border-radius: 100px;
    transition: width 0.5s ease;
    flex-shrink: 0;
}
.sm-bar2 { background: var(--accent2); }
.sm-bar3 { background: var(--accent3); }
.sm-prob-label { font-size: 0.72rem; color: var(--text2); min-width: 50px; }
.sm-prob-val { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text3); margin-left: auto; }
.sm-winner { color: var(--accent) !important; font-weight: 700; }
.sm-result {
    background: rgba(0,210,170,0.08);
    border: 1px solid rgba(0,210,170,0.2);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text2);
    text-align: center;
}
.sm-result strong { color: var(--accent); }

/* === Progress bar === */
.pipeline-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}
.pp-bar {
    flex: 1;
    height: 3px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
}
.pp-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 100px;
    width: 0%;
    transition: width 0.35s ease;
}
.pp-hint {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text3);
    white-space: nowrap;
}

@media (max-width: 900px) {
    .pd-inner { grid-template-columns: 1fr; }
    .pd-left { border-right: none; border-bottom: 1px solid var(--border); }
    .pf-step { min-width: 72px; padding: 0.75rem 0.6rem; }
    .pf-step-label { font-size: 0.72rem; }
    .pipeline-flow { gap: 0.15rem; }
}

@media (max-width: 600px) {
    .pipeline-flow { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.5rem; }
    .pf-arrow { display: none; }
    .cnn-pipeline-section { padding: 2rem 1rem 1.5rem; }
    .pd-left, .pd-right { padding: 1.25rem; }
}

/* ==================== SBS WALKER ==================== */
.sbs-walker {
    border-top: 1px solid var(--border);
    background: var(--bg2);
    padding: 1.5rem 2rem;
}

.sbs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.sbs-meta { display: flex; align-items: center; gap: 0.75rem; }

.sbs-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(0,210,170,0.1);
    border: 1px solid rgba(0,210,170,0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    white-space: nowrap;
}

.sbs-step-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text2);
}

.sbs-dots { display: flex; gap: 5px; align-items: center; }
.sbs-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--border2);
    background: var(--bg3);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}
.sbs-dot.active { background: var(--accent); border-color: var(--accent); }
.sbs-dot:hover:not(.active) { border-color: var(--text3); }

.sbs-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    min-height: 200px;
}

.sbs-visual {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sbs-calc {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
}

.sbs-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sbs-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.sbs-btn:hover:not(:disabled) { background: var(--bg4); border-color: var(--border2); }
.sbs-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.sbs-btn-next { background: rgba(0,210,170,0.1); border-color: rgba(0,210,170,0.3); color: var(--accent); }
.sbs-btn-next:hover:not(:disabled) { background: rgba(0,210,170,0.18); }

.sbs-prog {
    flex: 1;
    height: 3px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
}
.sbs-prog-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 100px;
    transition: width 0.3s ease;
}

/* ── Grid components ── */
.sc-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sc-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
}

.sc-grid-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text3);
    margin-bottom: 0.3rem;
    text-align: center;
}

.sc-grid {
    display: grid;
    gap: 2px;
    margin-bottom: 0.25rem;
}

.sc-cell {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 3px;
    border: 1px solid var(--border);
    background: var(--bg4);
    color: var(--text2);
    transition: all 0.2s;
}

/* Cell state highlights */
.sc-hi-blue    { background: rgba(0,153,255,0.15); border-color: rgba(0,153,255,0.4); color: #7cc8ff; }
.sc-hi-yellow  { background: rgba(255,204,68,0.12); border-color: rgba(255,204,68,0.3); color: var(--accent4); }
.sc-hi-accent  { background: rgba(0,210,170,0.2); border-color: var(--accent); color: var(--accent); font-weight: 800; }
.sc-done       { background: rgba(0,210,170,0.07); border-color: rgba(0,210,170,0.2); color: var(--accent); }
.sc-empty      { background: var(--bg4); color: var(--text3); border-style: dashed; }
.sc-c1         { background: rgba(0,153,255,0.1); border-color: rgba(0,153,255,0.25); color: #7cc8ff; }
.sc-c2         { background: rgba(0,210,170,0.1); border-color: rgba(0,210,170,0.25); color: var(--accent); }
.sc-c3         { background: rgba(255,204,68,0.1); border-color: rgba(255,204,68,0.25); color: var(--accent4); }
.sc-c4         { background: rgba(255,107,107,0.1); border-color: rgba(255,107,107,0.25); color: var(--accent3); }

.sc-op { color: var(--text3); font-size: 0.9rem; padding: 0 0.15rem; text-align: center; white-space: nowrap; }
.sc-op-down { color: var(--accent); font-size: 0.75rem; font-family: var(--font-mono); font-weight: 600; text-align: center; }

/* ── Calc box ── */
.sc-calc {
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    width: 100%;
}
.sc-calc-title {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text3);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
}
.sc-calc-line {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text2);
    line-height: 1.8;
    padding: 0.05rem 0;
}
.sc-sum { color: var(--accent); font-weight: 700; }
.sc-note { color: var(--text3); font-size: 0.7rem; font-style: italic; }
.sc-neg { color: var(--accent3); }
.sc-pos { color: var(--accent); }

/* ── Info box ── */
.sc-info {
    background: rgba(0,153,255,0.06);
    border: 1px solid rgba(0,153,255,0.15);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    font-size: 0.8rem;
    color: var(--text2);
    line-height: 1.7;
    width: 100%;
}

/* ── Result badge ── */
.sc-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius);
    font-size: 0.78rem;
}
.sc-result-accent {
    background: rgba(0,210,170,0.08);
    border: 1px solid rgba(0,210,170,0.2);
    color: var(--text2);
}
.sc-result-accent strong { color: var(--accent); }

/* ── Table ── */
.sc-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}
.sc-table th {
    background: var(--bg4);
    color: var(--text3);
    font-weight: 600;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    text-align: center;
    letter-spacing: 0.05em;
}
.sc-table td {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    color: var(--text2);
    text-align: center;
}
.sc-num { color: var(--accent4); font-weight: 700; }
.sc-hi-val { color: var(--accent) !important; }
.sc-small { font-size: 0.62rem; }
.sc-total-row td { background: rgba(0,210,170,0.07); color: var(--accent) !important; }

/* ── Vector wrap ── */
.sc-vec-wrap { text-align: center; }

/* ── Softmax prob bars ── */
.sc-prob-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
}
.sc-winner-row .sc-prob-label { color: var(--accent); }
.sc-prob-label { font-size: 0.78rem; min-width: 60px; color: var(--text2); }
.sc-sm-bar-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg4);
    border-radius: 100px;
    overflow: visible;
    height: 14px;
    position: relative;
}
.sc-sm-bar {
    height: 14px;
    border-radius: 100px;
    transition: width 0.5s ease;
    min-width: 3px;
}
.sc-bar-win { background: var(--accent); }
.sc-bar-2   { background: var(--accent2); }
.sc-bar-3   { background: var(--accent3); }
.sc-sm-pct {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text2);
    white-space: nowrap;
    margin-left: 0.25rem;
}

@media (max-width: 768px) {
    .sbs-body { grid-template-columns: 1fr; }
    .sbs-walker { padding: 1.25rem 1rem; }
    .sc-cell { width: 24px; height: 24px; font-size: 0.6rem; }
}

/* ==================== FC LAYER & BACKPROP ==================== */

/* Scalar input in settings panel */
.fc-scalar-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.35rem 0.6rem;
    text-align: right;
}
.fc-scalar-input:focus { outline: none; border-color: var(--accent); }

/* Flatten cells with subscript labels */
.fl-x { white-space: nowrap; }
.fl-x b { color: var(--accent4); }
.fl-x sub { font-size: 0.6em; color: var(--text3); }

/* FC Setup section */
.fc-setup-section {
    border-top: 2px solid rgba(0,153,255,0.25);
    padding-top: 1rem;
}

/* Weight grid */
.fc-weights-grid {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.6rem;
}
.fc-weight-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.fc-weight-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent2);
    min-width: 24px;
    text-align: right;
}
.fc-weight-label sub { font-size: 0.6em; }
.fc-weight-inp {
    width: 72px;
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    padding: 0.2rem 0.4rem;
    text-align: right;
}
.fc-weight-inp:focus { outline: none; border-color: var(--accent2); }
.fc-weight-xi {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text3);
    flex: 1;
}
.fc-weight-xi sub { font-size: 0.6em; }

/* FC param row */
.fc-param-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    margin-bottom: 0.7rem;
    background: var(--bg3);
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.fc-param-lbl { color: var(--text3); }
.fc-param-val { color: var(--accent4); font-weight: 700; margin-right: 0.3rem; }

/* FC calc button */
.btn-fc-calc {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
    background: rgba(0,153,255,0.12);
    border: 1px solid rgba(0,153,255,0.35);
    color: var(--accent2);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
}
.btn-fc-calc:hover:not(:disabled) {
    background: rgba(0,153,255,0.2);
    border-color: var(--accent2);
}
.btn-fc-calc:disabled { opacity: 0.4; cursor: not-allowed; }

/* FC Result Cards */
.fc-result-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 1rem;
    margin-top: 0.75rem;
}
.fc-card-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}
.fc-card-error .fc-card-title { color: var(--accent4); }
.fc-card-error { border-color: rgba(255,204,68,0.2); }
.fc-card-bp .fc-card-title { color: var(--accent3); }
.fc-card-bp { border-color: rgba(255,107,107,0.2); }

/* Chain rule box */
.bp-chain-box {
    background: var(--bg4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.6rem;
}
.bp-chain-title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text3);
    text-align: center;
    margin-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border2);
    padding-bottom: 0.4rem;
}
.bp-chain-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.bp-chain-term {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.15rem;
    min-width: 80px;
}
.bp-chain-num {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    border-bottom: 2px solid var(--border2);
    padding-bottom: 0.2rem;
    min-width: 60px;
    text-align: center;
}
.bp-chain-den {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text2);
}
.bp-chain-den sub { font-size: 0.6em; }
.bp-chain-sub {
    font-size: 0.62rem;
    color: var(--text3);
    font-style: italic;
    max-width: 120px;
    line-height: 1.3;
}
.bp-chain-mul {
    font-size: 1.2rem;
    color: var(--text3);
    padding-top: 0.3rem;
    font-weight: 700;
}

/* Bias update row */
.bp-bias-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg4);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.74rem;
}
.bp-bias-label { color: var(--text3); font-weight: 700; }
.bp-bias-formula { color: var(--text2); flex: 1; }
.bp-bias-val { font-weight: 700; }

/* Update formula footer */
.bp-update-formula {
    margin-top: 0.6rem;
    background: rgba(0,210,170,0.05);
    border: 1px solid rgba(0,210,170,0.15);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
}
.bpuf-title {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
}
.bpuf-line {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text2);
    line-height: 1.7;
}

/* ==================== FOOTER ==================== */
.footer {
    border-top: 1px solid var(--border);
    background: var(--bg2);
    padding: 1.25rem 2rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-brand { font-weight: 800; color: var(--accent); font-size: 0.9rem; }
.footer-copy { font-size: 0.75rem; color: var(--text3); font-family: var(--font-mono); }

/* ==================== 404 ==================== */
.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 1rem;
    text-align: center;
}

.nf-icon { font-size: 3rem; color: var(--accent); opacity: 0.3; }
.not-found h1 { font-size: 5rem; font-weight: 800; color: var(--text3); line-height: 1; }
.not-found p { color: var(--text2); }

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner { display: inline-block; animation: spin 0.8s linear infinite; }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .page-header { padding: 1.5rem 1rem 1rem; }
    .page-title { font-size: 1.4rem; }
    .conv-panel { max-height: none; position: static; border-right: none; border-bottom: 1px solid var(--border); }
    .conv-center { flex-direction: column; padding: 1rem; }
    .conv-results { padding: 1rem; grid-template-columns: 1fr; }
}

/* ==================== HOME HUB ==================== */
.hub-hero {
    position: relative;
    padding: 5rem 2rem 3rem;
    text-align: center;
    overflow: hidden;
}
.hub-hero-bg {
    position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.hub-hero-bg::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(0,210,170,0.08) 0%, transparent 70%);
}
.hub-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: rgba(0,210,170,0.08); border: 1px solid rgba(0,210,170,0.2);
    color: var(--accent); padding: 0.3rem 0.9rem;
    border-radius: 20px; font-size: 0.8rem; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 1.5rem;
}
.hub-title {
    font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 800;
    line-height: 1.1; letter-spacing: -0.03em;
    color: var(--text); margin-bottom: 1rem;
}
.hub-title .a1 { color: var(--accent); }
.hub-title .a2 { color: var(--accent2); }
.hub-desc {
    max-width: 560px; margin: 0 auto 2.5rem;
    color: var(--text2); font-size: 1rem; line-height: 1.7;
}
.hub-stats {
    display: flex; justify-content: center; gap: 3rem;
    flex-wrap: wrap; margin-top: 2rem;
}
.hub-stat { text-align: center; }
.hub-stat-num { font-size: 1.8rem; font-weight: 800; color: var(--accent); font-family: var(--font-mono); }
.hub-stat-num.rnn { color: var(--accent2); }
.hub-stat-label { font-size: 0.75rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.1rem; }

/* Topic sections */
.hub-section {
    padding: 3rem 2rem;
    max-width: 1200px; margin: 0 auto;
}
.hub-section-header {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.5rem;
}
.hub-section-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.25rem 0.75rem; border-radius: 6px;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.hub-section-badge.cnn { background: rgba(0,210,170,0.1); color: var(--accent); border: 1px solid rgba(0,210,170,0.2); }
.hub-section-badge.rnn { background: rgba(0,153,255,0.1); color: var(--accent2); border: 1px solid rgba(0,153,255,0.2); }
.hub-section-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.hub-section-desc { color: var(--text2); font-size: 0.9rem; margin-left: auto; }

.hub-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.hub-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius2); padding: 1.5rem;
    text-decoration: none; color: inherit;
    transition: all 0.22s;
    position: relative; overflow: hidden;
}
.hub-card::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, var(--card-glow, rgba(0,210,170,0.04)) 0%, transparent 60%);
    opacity: 0; transition: opacity 0.22s;
}
.hub-card:hover { border-color: var(--card-border, var(--accent)); transform: translateY(-3px); box-shadow: 0 8px 32px var(--card-shadow, rgba(0,210,170,0.1)); }
.hub-card:hover::before { opacity: 1; }
.hub-card.rnn { --card-glow: rgba(0,153,255,0.06); --card-border: var(--accent2); --card-shadow: rgba(0,153,255,0.12); }
.hub-card.concepts { --card-glow: rgba(255,204,68,0.06); --card-border: var(--accent4); --card-shadow: rgba(255,204,68,0.1); }

.hub-card-icon { font-size: 1.8rem; margin-bottom: 0.75rem; display: block; }
.hub-card-icon.cnn { color: var(--accent); }
.hub-card-icon.rnn { color: var(--accent2); }
.hub-card-icon.concepts { color: var(--accent4); }
.hub-card-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.4rem; }
.hub-card-desc { font-size: 0.82rem; color: var(--text2); line-height: 1.55; margin-bottom: 1rem; }
.hub-card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.hub-card-tag {
    font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 4px;
    background: var(--bg3); color: var(--text3);
    font-family: var(--font-mono); border: 1px solid var(--border);
}
.hub-card-link { font-size: 0.8rem; font-weight: 600; color: var(--accent); }
.hub-card.rnn .hub-card-link { color: var(--accent2); }
.hub-card.concepts .hub-card-link { color: var(--accent4); }

.hub-divider {
    border: none; border-top: 1px solid var(--border);
    max-width: 1200px; margin: 0 auto;
}

[data-theme="light"] .hub-card { background: var(--bg2); }

/* ==================== RNN CALCULATOR ==================== */
.rnn-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    min-height: calc(100vh - 60px);
}
.rnn-panel {
    background: var(--bg2);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
}
.rnn-main {
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--bg);
}
.rnn-panel-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--text3); margin-bottom: 1rem;
    padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}
.rnn-panel-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.rnn-panel-section:last-child { border-bottom: none; }
.rnn-param-label {
    font-size: 0.72rem; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem;
}
.rnn-param-row { margin-bottom: 0.75rem; }
.rnn-input {
    width: 100%; background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius); padding: 0.4rem 0.6rem;
    font-family: var(--font-mono); font-size: 0.8rem; transition: border-color 0.2s;
}
.rnn-input:focus { outline: none; border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(0,153,255,0.1); }
.rnn-select {
    width: 100%; background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius); padding: 0.4rem 0.6rem;
    font-size: 0.8rem; cursor: pointer;
}
[data-theme="light"] .rnn-input,
[data-theme="light"] .rnn-select { background: var(--bg4); border-color: var(--border); color: var(--text); }

.rnn-matrix-grid {
    display: grid; gap: 2px;
}
.rnn-matrix-cell {
    width: 100%; background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); border-radius: 4px; padding: 0.3rem 0.35rem;
    font-family: var(--font-mono); font-size: 0.75rem; text-align: center;
    transition: border-color 0.15s;
}
.rnn-matrix-cell:focus { outline: none; border-color: var(--accent2); }
[data-theme="light"] .rnn-matrix-cell { background: var(--bg4); }

.rnn-matrix-label {
    font-size: 0.7rem; color: var(--text3); margin-bottom: 0.3rem;
    font-family: var(--font-mono);
}
.rnn-size-ctrl { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; }
.rnn-size-btn {
    width: 24px; height: 24px; background: var(--bg3); border: 1px solid var(--border);
    color: var(--text2); border-radius: 4px; cursor: pointer; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.rnn-size-btn:hover { background: var(--bg4); color: var(--accent2); border-color: var(--accent2); }
.rnn-size-val { font-size: 0.8rem; font-family: var(--font-mono); color: var(--text2); min-width: 1.5rem; text-align: center; }

.rnn-calc-btn {
    width: 100%; padding: 0.75rem; background: var(--accent2); color: #fff;
    border: none; border-radius: var(--radius); font-size: 0.9rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s; font-family: var(--font-ui);
    letter-spacing: 0.02em;
}
.rnn-calc-btn:hover { background: #0080dd; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,153,255,0.3); }
.rnn-calc-btn:active { transform: none; }

/* RNN Result area */
.rnn-results-header {
    display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem;
    padding-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.rnn-results-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.rnn-type-badge {
    padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700;
    background: rgba(0,153,255,0.1); color: var(--accent2); border: 1px solid rgba(0,153,255,0.2);
    text-transform: uppercase; letter-spacing: 0.05em;
}

.rnn-formula-box {
    background: var(--bg2); border: 1px solid var(--border);
    border-left: 3px solid var(--accent2);
    border-radius: var(--radius); padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.rnn-formula-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); margin-bottom: 0.5rem; }
.rnn-formula-eq {
    font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent2);
    line-height: 1.9;
}
.rnn-formula-eq span.hl-h { color: var(--accent); }
.rnn-formula-eq span.hl-x { color: var(--accent4); }
.rnn-formula-eq span.hl-y { color: var(--accent3); }
.rnn-formula-eq span.hl-w { color: #cc88ff; }

/* Unrolled diagram */
.rnn-diagram {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius2); padding: 1.5rem;
    margin-bottom: 1.5rem; overflow-x: auto;
}
.rnn-diagram-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); margin-bottom: 1rem; }
.rnn-unroll {
    display: flex; align-items: flex-start; gap: 0;
    min-width: max-content;
}
.rnn-cell-block {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
    position: relative;
}
.rnn-cell-input {
    background: rgba(255,204,68,0.1); border: 1px solid rgba(255,204,68,0.3);
    color: var(--accent4); border-radius: 6px; padding: 0.4rem 0.6rem;
    font-family: var(--font-mono); font-size: 0.75rem; text-align: center;
    min-width: 60px;
}
.rnn-cell-box {
    background: rgba(0,153,255,0.08); border: 2px solid rgba(0,153,255,0.35);
    color: var(--accent2); border-radius: 8px; padding: 0.6rem 1rem;
    font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700;
    text-align: center; min-width: 70px;
    position: relative;
}
.rnn-cell-box.computed {
    background: rgba(0,153,255,0.15); border-color: var(--accent2);
    box-shadow: 0 0 12px rgba(0,153,255,0.2);
}
.rnn-cell-output {
    background: rgba(255,107,107,0.08); border: 1px solid rgba(255,107,107,0.25);
    color: var(--accent3); border-radius: 6px; padding: 0.4rem 0.6rem;
    font-family: var(--font-mono); font-size: 0.75rem; text-align: center;
    min-width: 60px;
}
.rnn-cell-label { font-size: 0.65rem; color: var(--text3); font-family: var(--font-mono); text-align: center; }
.rnn-arrow-h {
    display: flex; align-items: center; padding: 0 0.25rem;
    color: var(--accent); font-size: 0.9rem;
    margin-top: calc(0.5rem + 0.5rem + 0.75rem + 0.5rem + 2.2rem);
}
.rnn-arrow-v {
    width: 1px; height: 20px; background: var(--border2);
    margin: 0 auto;
}

/* Step-by-step */
.rnn-steps {
    display: flex; flex-direction: column; gap: 1rem;
}
.rnn-step {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius2); overflow: hidden;
}
.rnn-step-header {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg3); cursor: pointer;
    user-select: none;
}
.rnn-step-num {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,153,255,0.15); color: var(--accent2);
    border: 1px solid rgba(0,153,255,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; font-family: var(--font-mono);
    flex-shrink: 0;
}
.rnn-step-title { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.rnn-step-time { font-size: 0.72rem; color: var(--text3); font-family: var(--font-mono); }
.rnn-step-toggle { margin-left: auto; color: var(--text3); font-size: 0.7rem; transition: transform 0.2s; }
.rnn-step.open .rnn-step-toggle { transform: rotate(180deg); }

.rnn-step-body {
    padding: 1rem 1.25rem;
    display: none;
    border-top: 1px solid var(--border);
}
.rnn-step.open .rnn-step-body { display: block; }

.rnn-calc-row {
    display: grid; grid-template-columns: auto 1fr;
    gap: 0.4rem 1rem; margin-bottom: 0.75rem; align-items: start;
}
.rnn-calc-lhs {
    font-family: var(--font-mono); font-size: 0.8rem; color: var(--text3);
    white-space: nowrap; padding-top: 0.1rem;
}
.rnn-calc-rhs {
    font-family: var(--font-mono); font-size: 0.8rem; color: var(--text2);
    line-height: 1.6;
}
.rnn-val-h { color: var(--accent); font-weight: 600; }
.rnn-val-x { color: var(--accent4); font-weight: 600; }
.rnn-val-y { color: var(--accent3); font-weight: 600; }
.rnn-val-result { color: var(--text); font-weight: 700; }

.rnn-vector-display {
    display: flex; flex-wrap: wrap; gap: 4px; margin-top: 0.3rem;
}
.rnn-vec-val {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 4px; padding: 0.2rem 0.45rem;
    font-family: var(--font-mono); font-size: 0.75rem; color: var(--text2);
}
.rnn-vec-val.h-val { border-color: rgba(0,210,170,0.25); color: var(--accent); background: rgba(0,210,170,0.06); }
.rnn-vec-val.y-val { border-color: rgba(255,107,107,0.25); color: var(--accent3); background: rgba(255,107,107,0.06); }

.rnn-summary-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius2); padding: 1.25rem;
    margin-top: 1.5rem;
}
.rnn-summary-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); margin-bottom: 1rem; }
.rnn-summary-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0.75rem; margin-bottom: 0.75rem;
}
.rnn-summary-item { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; }
.rnn-summary-label { font-size: 0.68rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }
.rnn-summary-val { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text); font-weight: 600; }

.rnn-placeholder {
    text-align: center; padding: 4rem 2rem; color: var(--text3);
}
.rnn-placeholder-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.rnn-placeholder-text { font-size: 0.9rem; }

/* sequence input */
.rnn-seq-row { display: flex; flex-direction: column; gap: 0.4rem; }
.rnn-seq-step {
    display: flex; align-items: center; gap: 0.5rem;
}
.rnn-seq-label { font-size: 0.72rem; color: var(--text3); font-family: var(--font-mono); width: 36px; flex-shrink: 0; }
.rnn-seq-inputs { display: flex; gap: 3px; flex: 1; }
.rnn-seq-inputs .rnn-input { padding: 0.3rem 0.35rem; text-align: center; font-size: 0.75rem; }

/* Add/remove step buttons */
.rnn-seq-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.rnn-seq-action-btn {
    flex: 1; padding: 0.3rem; background: var(--bg3); border: 1px solid var(--border);
    color: var(--text2); border-radius: var(--radius); font-size: 0.75rem;
    cursor: pointer; transition: all 0.15s; font-family: var(--font-ui);
}
.rnn-seq-action-btn:hover { background: var(--bg4); color: var(--accent2); border-color: var(--accent2); }

@media (max-width: 900px) {
    .rnn-layout { grid-template-columns: 1fr; }
    .rnn-panel { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── LSTM hub card ─────────────────────────────── */
.hub-card.lstm { --card-glow: rgba(167,139,250,0.06); --card-border: #a78bfa; --card-shadow: rgba(167,139,250,0.12); }
.hub-card-icon.lstm { color: #a78bfa; }

/* ── Concept dropdown (expanded details) ──────── */
.concept-card { position: relative; }
.ccard-dropdown-toggle {
    display: inline-flex; align-items: center; gap: .3rem;
    margin-top: .55rem; font-size: .68rem; font-weight: 600;
    color: var(--accent); cursor: pointer; user-select: none;
    background: rgba(0,210,170,.06); border: 1px solid rgba(0,210,170,.15);
    border-radius: 5px; padding: .18rem .5rem;
    transition: all .2s;
}
.ccard-dropdown-toggle:hover { background: rgba(0,210,170,.12); }
.ccard-dropdown-toggle .dd-chevron { transition: transform .2s; font-size: .6rem; }
.ccard-dropdown-toggle.open .dd-chevron { transform: rotate(180deg); }
.ccard-detail {
    display: none; margin-top: .5rem;
    background: var(--surface3, rgba(255,255,255,.03));
    border: 1px solid var(--border); border-radius: 7px;
    padding: .65rem .75rem; font-size: .75rem; color: var(--text2);
    line-height: 1.55;
}
.ccard-detail.open { display: block; }
.ccard-detail h5 { font-size: .72rem; font-weight: 700; color: var(--text); margin: 0 0 .3rem; }
.ccard-detail .dd-formula {
    background: var(--surface2, rgba(0,0,0,.15)); border-radius: 5px;
    padding: .3rem .55rem; font-family: monospace; font-size: .72rem;
    color: var(--accent); margin: .35rem 0; display: inline-block;
}
.ccard-detail ul { margin: .3rem 0 0 1rem; padding: 0; }
.ccard-detail ul li { margin-bottom: .2rem; }
.ccard-detail .dd-note { font-size: .68rem; color: var(--text3); margin-top: .4rem; font-style: italic; }
.ccard-detail .dd-tag-row { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .4rem; }
.ccard-detail .dd-pill {
    font-size: .6rem; padding: .1rem .35rem; border-radius: 4px;
    background: rgba(0,210,170,.08); color: var(--accent); border: 1px solid rgba(0,210,170,.15);
}

/* ══ Page Zoom Bar ════════════════════════════════════════════════════════════ */
.page-zoom-bar {
    position: fixed;
    bottom: 1.2rem;
    right: 1.2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .4rem;
}
.pzb-btn {
    width: 2.2rem; height: 2.2rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text2);
    font-size: 1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    transition: background .15s, color .15s;
}
.pzb-btn:hover { background: var(--bg4); color: var(--accent); }

.pzb-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .7rem;
    min-width: 220px;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.pzb-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: .5rem;
}
.pzb-title { font-size: .78rem; font-weight: 700; color: var(--text); }
.pzb-close {
    background: none; border: none; color: var(--text3);
    cursor: pointer; font-size: .85rem; padding: 0 .2rem;
    transition: color .15s;
}
.pzb-close:hover { color: var(--accent2); }

.pzb-body { display: flex; flex-direction: column; gap: .5rem; }

.pzb-row {
    display: flex; align-items: center; gap: .4rem;
}
.pzb-step-btn {
    width: 1.8rem; height: 1.8rem; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg3); color: var(--text2);
    font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.pzb-step-btn:hover { background: var(--bg4); color: var(--accent); }

.pzb-select {
    flex: 1; padding: .25rem .4rem;
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text2); border-radius: var(--radius);
    font-size: .72rem; cursor: pointer;
    font-family: var(--font-ui, inherit);
}
.pzb-select:focus { outline: 1px solid var(--accent); }

.pzb-slider-row {
    display: flex; align-items: center; gap: .4rem;
}
.pzb-tiny { font-size: .65rem; color: var(--text3); white-space: nowrap; }
.pzb-slider {
    flex: 1; accent-color: var(--accent);
    cursor: pointer;
}

.pzb-current {
    text-align: center; font-size: .72rem;
    color: var(--accent); font-weight: 600;
}
.pzb-reset {
    width: 100%; padding: .3rem;
    background: rgba(0,210,170,.08);
    border: 1px solid rgba(0,210,170,.2);
    color: var(--accent); border-radius: var(--radius);
    font-size: .72rem; cursor: pointer;
    transition: background .15s;
    font-family: var(--font-ui, inherit);
}
.pzb-reset:hover { background: rgba(0,210,170,.18); }

/* ══ VISUALISASI KONVOLUSI 2D ════════════════════════════════════════════════ */
.conv-viz-section {
    margin: 2rem 0;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    overflow: hidden;
}

.cviz-header {
    padding: 1.2rem 1.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(0,210,170,0.05) 0%, transparent 60%);
}
.cviz-title {
    font-size: 1.05rem; font-weight: 700;
    color: var(--text); margin: 0 0 0.25rem;
    font-family: var(--font-ui, 'Syne', sans-serif);
}
.cviz-sub {
    font-size: 0.78rem; color: var(--text3);
    margin: 0;
}

/* Stage: 3-column layout */
.cviz-stage {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.2rem;
    padding: 1.2rem 1.5rem;
    align-items: start;
}

.cviz-col {
    display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
}
.cviz-col-kernel {
    min-width: 180px; max-width: 260px;
}

.cviz-col-label {
    font-size: 0.72rem; font-weight: 700;
    color: var(--text2); letter-spacing: 0.03em;
    text-transform: uppercase; align-self: flex-start;
}
.cviz-dim {
    font-weight: 400; color: var(--accent); margin-left: 0.35rem;
    text-transform: none; letter-spacing: 0;
}

.cviz-canvas-wrap {
    display: flex; justify-content: center;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem;
    overflow: auto; max-width: 100%;
}
.cviz-canvas-wrap canvas {
    display: block; border-radius: 3px;
    image-rendering: pixelated;
}

/* Legend */
.cviz-legend {
    display: flex; gap: 0.8rem; flex-wrap: wrap; justify-content: center;
}
.cviz-legend-item {
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.65rem; color: var(--text3);
}
.cviz-dot {
    width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}
.cviz-dot.hi  { background: rgba(10,210,170,1); }
.cviz-dot.lo  { background: rgba(10,60,120,1); }
.cviz-dot.neg { background: rgba(220,50,70,1); }

/* Math box */
.cviz-math-box {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
}
.cviz-math-title {
    font-size: 0.65rem; font-weight: 700;
    color: var(--text3); text-transform: uppercase;
    letter-spacing: 0.06em; margin-bottom: 0.4rem;
}
.cviz-math-content { font-size: 0.7rem; color: var(--text2); min-height: 1.4rem; }
.cviz-math-grid {
    display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.3rem;
}
.cviz-mterm {
    background: rgba(0,210,170,0.08);
    border: 1px solid rgba(0,210,170,0.15);
    border-radius: 3px; padding: 0.1rem 0.3rem;
    font-family: 'JetBrains Mono', monospace; font-size: 0.65rem;
    color: var(--text2);
}
.cviz-math-eq {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem; color: var(--text3);
    word-break: break-all; line-height: 1.5;
    max-height: 3.5rem; overflow: hidden;
}
.cviz-math-sum {
    margin-top: 0.4rem; font-size: 0.75rem; font-weight: 600;
    color: var(--text2); border-top: 1px solid var(--border); padding-top: 0.3rem;
}
.cviz-sum-val { font-family: 'JetBrains Mono', monospace; margin-left: 0.2rem; }
.cviz-sum-val.pos { color: var(--accent); }
.cviz-sum-val.neg { color: var(--accent3); }

/* Progress */
.cviz-progress-row {
    display: flex; align-items: center; gap: 0.5rem; width: 100%;
}
.cviz-progress-bar {
    flex: 1; height: 5px; background: rgba(255,255,255,0.08);
    border-radius: 3px; overflow: hidden;
}
.cviz-progress-fill {
    height: 100%; width: 0%; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, #06b6d4 100%);
    transition: width 0.3s ease;
}
.cviz-progress-label {
    font-size: 0.65rem; color: var(--text3);
    white-space: nowrap; font-family: 'JetBrains Mono', monospace;
}

/* Controls bar */
.cviz-controls {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg3);
}
.cviz-btn {
    padding: 0.35rem 0.85rem; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg4);
    color: var(--text2); font-size: 0.78rem; cursor: pointer;
    transition: all 0.15s; font-family: 'JetBrains Mono', monospace;
}
.cviz-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.cviz-btn-play {
    background: var(--accent); color: #fff; border-color: var(--accent);
    font-weight: 700; padding: 0.35rem 1.1rem;
}
.cviz-btn-play:hover { background: #00c4a0; border-color: #00c4a0; }
.cviz-btn-reset { margin-left: auto; }

.cviz-speed-group {
    display: flex; align-items: center; gap: 0.35rem; margin-left: 0.5rem;
}
.cviz-speed-label { font-size: 0.7rem; color: var(--text3); }
.cviz-speed-sel {
    padding: 0.25rem 0.4rem;
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text2); border-radius: var(--radius);
    font-size: 0.72rem; cursor: pointer;
}
.cviz-step-counter {
    font-size: 0.7rem; color: var(--text3);
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.25rem 0.5rem;
    margin-left: 0.25rem;
}

/* Step detail strip */
.cviz-step-detail {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    padding: 0.5rem 1.5rem;
    font-size: 0.72rem; color: var(--text3);
    border-top: 1px solid var(--border);
    transition: opacity 0.3s;
    font-family: 'JetBrains Mono', monospace;
}
.cviz-sd-label { color: var(--text3); }
.cviz-sd-val   { color: var(--text2); font-weight: 600; }
.cviz-sd-sep   { color: var(--accent); }
.cviz-accent   { color: var(--accent) !important; }

/* Responsive */
@media (max-width: 820px) {
    .cviz-stage {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    .cviz-col { align-items: flex-start; }
    .cviz-col-kernel { min-width: 0; max-width: 100%; }
    .cviz-controls { gap: 0.4rem; }
    .cviz-btn-reset { margin-left: 0; }
}
