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

/* Georgia Tech color palette */
:root {
    --color-primary: #B3A369;   /* Tech Gold */
    --color-secondary: #003057; /* GT Navy */
    --color-tertiary: #FFFFFF;  /* White */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Page background: top (gold) → bottom (blue) */
    background: linear-gradient(to bottom, var(--color-primary) 0%, var(--color-secondary) 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    overflow: hidden; /* default for compact demos; overridden below for active demo view */
}

/* Allow scrolling on homepage */
body:has(.homepage.active) {
    overflow: auto;
}

/* No scrolling on desktop for demo pages - fit to viewport */
@media (min-width: 769px) {
    body:has(.demo-view.active) {
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow: auto; /* Always allow scrolling on mobile */
    }
}

/* ====== Info Button & Popup ====== */
.info-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #667eea;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: rgba(240, 240, 255, 0.95);
}

@media (max-width: 768px) {
    .info-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
        top: 15px;
        right: 15px;
    }
}

.info-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.info-popup.active {
    display: flex;
}

.info-popup-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideIn 0.3s ease;
}

@media (max-width: 768px) {
    .info-popup-content {
        padding: 30px 20px;
        width: 95%;
        max-height: 90vh;
    }
}

.info-popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 36px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.info-popup-close:hover {
    color: #333;
}

.info-popup-content h2 {
    color: #667eea;
    font-size: 2em;
    margin-bottom: 20px;
}

.info-popup-content h3 {
    color: #764ba2;
    font-size: 1.2em;
    margin-bottom: 10px;
    margin-top: 0;
}

.info-popup-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.info-section {
    margin-top: 25px;
}

.info-popup-content a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.info-popup-content a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* No JavaScript Warning (Red X) */
.js #nojs-warning { display: none !important; }
#nojs-warning { display: none; }
.noscript-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.noscript-warning-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 85%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    text-align: center;
}

.noscript-warning-icon {
    width: 80px;
    height: 80px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    position: relative;
}

.noscript-warning-icon::before,
.noscript-warning-icon::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 4px;
}

.noscript-warning-icon::before {
    width: 6px;
    height: 40px;
    transform: rotate(45deg);
}

.noscript-warning-icon::after {
    width: 6px;
    height: 40px;
    transform: rotate(-45deg);
}

.noscript-warning-content h2 {
    color: #ef4444;
    font-size: 1.8em;
    margin-bottom: 16px;
    font-weight: 700;
}

.noscript-warning-content p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 1em;
}

.noscript-warning-content p:last-of-type {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .noscript-warning-content {
        padding: 32px 24px;
    }

    .noscript-warning-content h2 {
        font-size: 1.5em;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    max-height: calc(100vh - 40px); /* Fit within viewport */
}

/* Allow container to grow on homepage */
.container:has(.homepage.active) {
    max-height: none;
}

/* Keep container height-constrained for demos on desktop */
@media (min-width: 769px) {
    .container:has(.demo-view.active) {
        max-height: calc(100vh - 40px);
        overflow: hidden;
    }
}

/* Allow container to grow for mobile demos */
@media (max-width: 768px) {
    .container {
        border-radius: 10px;
        max-height: none; /* Allow full height on mobile */
    }
    
    .container:has(.demo-view.active) {
        max-height: none;
    }
}

/* ====== Homepage Styles ====== */
.homepage {
    display: none;
    min-height: 100vh;
}

.homepage.active {
    display: block;
}

.hero {
    /* Hero banner uses the same top (gold) → bottom (blue) gradient */
    background: linear-gradient(to bottom, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    padding: 80px 40px;
    text-align: center;
}

.hero h1 {
    font-size: 4em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation: fadeInDown 0.8s ease-out;
}

.hero .subtitle {
    font-size: 1.4em;
    opacity: 0.95;
    animation: fadeInUp 0.8s ease-out;
}

@media (max-width: 768px) {
    .hero {
        padding: 40px 20px;
    }
    
    .hero h1 {
        font-size: 2.5em;
    }
    
    .hero .subtitle {
        font-size: 1.1em;
    }
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    padding: 60px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .demo-grid {
        grid-template-columns: 1fr;
        padding: 30px 20px;
        gap: 20px;
    }
}

.demo-card {
    background: white;
    border-radius: 15px;
    padding: 35px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.demo-card.wide {
    grid-column: span 3;
}

@media (max-width: 768px) {
    .demo-card {
        padding: 25px;
    }
    
    .demo-card.wide {
        grid-column: span 1;
    }
}

.demo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.demo-card:hover::before {
    transform: scaleX(1);
}

.demo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.demo-icon {
    font-size: 3.5em;
    margin-bottom: 20px;
    text-align: center;
}

.demo-card h3 {
    color: #667eea;
    font-size: 1.6em;
    margin-bottom: 15px;
    font-weight: 700;
}

.demo-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    min-height: 60px;
}

@media (max-width: 768px) {
    .demo-card p {
        min-height: auto;
    }
}

.demo-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    background: #f0f0f0;
    color: #667eea;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.homepage-footer {
    background: #f5f5f5;
    padding: 30px;
    text-align: center;
    color: #666;
    font-size: 0.95em;
}

/* ====== Demo View Styles ====== */
.demo-view {
    display: none;
}

.demo-view.active {
    display: block;
    height: 100%;
    position: relative;
}

/* Allow scrolling on mobile */
@media (max-width: 768px) {
    .demo-view.active {
        height: auto;
        overflow: visible;
    }
}

.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
}

.back-button:hover {
    background: #667eea;
    color: white;
    transform: translateX(-3px);
}

@media (max-width: 768px) {
    .back-button {
        position: fixed;
        padding: 10px 16px;
        font-size: 0.9em;
        top: 15px;
        left: 15px;
    }
}

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

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

/* ====== Original Header (for demo pages) ====== */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.visualization-section {
    display: none;
    padding: 80px 40px 40px 40px;
    height: 100%;
    overflow: hidden;
}

.visualization-section.active {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 40px;
    height: 100%;
}

/* Desktop-only: make modules fit viewport without scrolling */
@media (min-width: 1025px) {
    /* Switch to float-based layout so text can wrap under the diagram */
    .visualization-section.active {
        display: block;
        height: 100%;
        overflow: hidden;
        position: relative;
    }

    /* Float the diagram right; allow text to flow alongside and then beneath */
    .visualization-section.active .canvas-container {
        float: right;
        width: clamp(420px, 48%, 720px);
        margin: 0 0 20px 24px;
        max-height: calc(100vh - 160px);
    }

    /* Ensure the section establishes a new block formatting context and clears floats */
    .visualization-section.active::after {
        content: "";
        display: block;
        clear: both;
    }

    /* Let the info panel have its own scrollbar */
    .visualization-section.active .info-panel {
        overflow-y: auto;
        overflow-x: hidden;
        max-height: calc(100vh - 160px);
        padding-right: 15px;
    }

    /* Make key demo canvases scale to fit viewport */
    #autoencoder .canvas-container canvas,
    #rbm .canvas-container canvas,
    #normalizing-flow .canvas-container canvas,
    #transformer .canvas-container canvas,
    #deep-perceptron .canvas-container canvas,
    #mamba2 .canvas-container canvas,
    #cnn-encoder-decoder .canvas-container canvas,
    #hopfield .canvas-container canvas,
    #ising .canvas-container canvas,
    #perceptron .canvas-container canvas,
    #vae .canvas-container canvas,
    #cuda .canvas-container canvas {
        height: auto;
        max-height: calc(100vh - 240px);
        min-height: 350px;
    }

    /* Ensure the drawing area itself fits within viewport */
    #autoencoder .canvas-container,
    #rbm .canvas-container,
    #normalizing-flow .canvas-container,
    #transformer .canvas-container,
    #deep-perceptron .canvas-container,
    #mamba2 .canvas-container,
    #cnn-encoder-decoder .canvas-container,
    #hopfield .canvas-container,
    #ising .canvas-container,
    #perceptron .canvas-container,
    #vae .canvas-container,
    #cuda .canvas-container {
        height: auto;
        max-height: calc(100vh - 160px);
        overflow: hidden;
    }
}

@media (max-width: 1024px) {
    .visualization-section.active {
        grid-template-columns: 1fr;
        gap: 20px;
        height: auto;
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .visualization-section {
        padding: 70px 15px 15px;
        height: auto;
        overflow-y: auto;
    }
    
    .visualization-section.active {
        grid-template-columns: 1fr;
        gap: 15px;
        height: auto;
        overflow: visible;
    }
}

.info-panel {
    overflow-y: auto;
    overflow-x: hidden;
}

@media (min-width: 769px) {
    .info-panel {
        max-height: calc(100vh - 160px);
        padding-right: 5px;
    }
}

/* Custom sleek scrollbar styling for info panel */
.info-panel::-webkit-scrollbar {
    width: 6px;
}

.info-panel::-webkit-scrollbar-track {
    background: transparent;
    margin-top: 4px;
    margin-bottom: 4px;
}

.info-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.info-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    width: 8px;
}

/* Firefox scrollbar styling */
.info-panel {
    scrollbar-width: thin;
    scrollbar-color: #667eea transparent;
}

.info-panel h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2em;
}

@media (max-width: 768px) {
    .info-panel h2 {
        font-size: 1.5em;
    }
}

.description {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #555;
}

.explanation-box {
    background: #f9f9f9;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.explanation-box h3 {
    color: #764ba2;
    margin-bottom: 15px;
    font-size: 1.3em;
}

@media (max-width: 768px) {
    .explanation-box {
        padding: 15px;
        margin: 15px 0;
    }
    
    .explanation-box h3 {
        font-size: 1.1em;
    }
}

.explanation-box ul {
    list-style: none;
    padding: 0;
}

.explanation-box li {
    padding: 8px 0;
    line-height: 1.5;
    color: #555;
}

.explanation-box strong {
    color: #667eea;
    font-weight: 600;
}

/* Citation Box Styling */
.citation-box {
    background: linear-gradient(135deg, #f0f4ff 0%, #faf9ff 100%);
    border-left: 4px solid #764ba2;
    padding: 18px 20px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(118, 75, 162, 0.1);
}

.citation-box h3 {
    color: #764ba2;
    margin-bottom: 12px;
    font-size: 1.15em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.citation-box h3::before {
    content: "📖";
    font-size: 1.2em;
}

.citation-box p {
    margin: 8px 0;
    color: #555;
    line-height: 1.6;
}

.citation-box a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.citation-box a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

.citation-box .paper-title {
    font-style: italic;
    font-weight: 600;
    color: #333;
}

.citation-box .paper-authors {
    color: #666;
    font-size: 0.95em;
}

.citation-box .paper-venue {
    color: #888;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .citation-box {
        padding: 15px;
        margin: 15px 0;
    }
    
    .citation-box h3 {
        font-size: 1.05em;
    }
}

.controls {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Transformer next-token UI */
.control-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

#transformer-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1.05em;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fafafa;
}

#transformer-input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.results {
    margin-top: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
    border: 2px solid #e8ebf7;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.results-header {
    font-weight: 700;
    color: #667eea;
    margin-bottom: 12px;
    font-size: 1.05em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.token-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.token-item {
    display: grid;
    grid-template-columns: 140px 1fr 70px;
    align-items: center;
    gap: 12px;
    font-size: 0.95em;
    padding: 8px 12px;
    background: #fff;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: default;
}

.token-item:hover {
    transform: translateX(4px);
    border-color: #667eea;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.15);
    background: linear-gradient(135deg, #fafbff 0%, #fff 100%);
}

.token-label {
    font-weight: 600;
    color: #444;
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.token-bar {
    height: 14px;
    background: #f1f1f9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.token-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 8px;
    transition: width 0.3s ease;
    animation: fillBar 0.6s ease-out;
}

@keyframes fillBar {
    from {
        width: 0 !important;
    }
}

.token-prob {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #667eea;
    font-weight: 700;
    font-size: 0.95em;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.9;
    }
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
    color: #999;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #555;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.canvas-container {
    position: relative;
    background: #fafafa;
    border-radius: 10px;
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

@media (min-width: 769px) {
    .canvas-container {
        height: 100%;
    }
}

canvas {
    display: block;
    width: 100%;
    border-radius: 8px;
    flex: 1;
}

@media (min-width: 769px) {
    canvas {
        height: auto;
        max-height: 100%;
        min-height: 300px;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    canvas {
        height: 250px;
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .canvas-container {
        padding: 15px;
        height: auto;
    }
    
    canvas {
        height: 450px;
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    canvas {
        height: 400px;
        min-height: 300px;
    }
}

.layer-labels {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.autoencoder-labels {
    justify-content: space-between;
}

.label {
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .layer-labels {
        justify-content: center;
        gap: 8px;
        margin-top: 15px;
        padding: 5px;
    }
    
    .label {
        padding: 6px 12px;
        font-size: 0.75em;
    }
}

.visible-label {
    background: #e3f2fd;
    color: #1976d2;
}

.hidden-label {
    background: #f3e5f5;
    color: #7b1fa2;
}

.input-label, .output-label {
    background: #e8f5e9;
    color: #388e3c;
}

.encoder-label, .decoder-label {
    background: #fff9c4;
    color: #f57f17;
}

.latent-label {
    background: #ffe0b2;
    color: #e65100;
}

/* Deep Perceptron specific labels */
.deep-input-label {
    background: #d6ebf7;
    color: #4A90E2;
}

.deep-hidden-label:nth-child(2) {
    background: #e8daef;
    color: #9B59B6;
}

.deep-hidden-label:nth-child(3) {
    background: #fadbd8;
    color: #E74C3C;
}

.deep-hidden-label:nth-child(4) {
    background: #fef5e7;
    color: #F39C12;
}

.deep-output-label {
    background: #d4f4e5;
    color: #50E3C2;
}

/* Normalizing Flow specific labels */
.nf-base-label {
    background: #e0eef9;
    color: #4f7fb0;
}

.nf-flow1-label {
    background: #e8daef;
    color: #7d3c98;
}

.nf-flow2-label {
    background: #fce4ff;
    color: #b028d9;
}

.nf-flow3-label {
    background: #d4ecf9;
    color: #2874a6;
}

.nf-data-label {
    background: #ffebd6;
    color: #d97706;
}

/* VAE specific labels */
.vae-input-label {
    background: #d4f4ea;
    color: #34a384;
}

.vae-encoder-label {
    background: #fdd4d8;
    color: #9b3848;
}

.vae-latent-label {
    background: #fff8dc;
    color: #c4930d;
}

.vae-output-label {
    background: #d4f4ea;
    color: #34a384;
}

/* CNN Encoder-Decoder specific labels */
.cnn-input-label {
    background: #d6eaf8;
    color: #2874a6;
}

.cnn-conv-label {
    background: #e8daef;
    color: #7d3c98;
}

.cnn-latent-label {
    background: #fadbd8;
    color: #c0392b;
}

.cnn-deconv-label {
    background: #e8daef;
    color: #7d3c98;
}

.cnn-output-label {
    background: #d5f4e6;
    color: #27ae60;
}

/* Mamba2 specific labels */
.mamba2-input-label {
    background: rgba(108, 92, 231, 0.15);
    color: #6C5CE7;
    border: 2px solid #6C5CE7;
}

.mamba2-ssm-label {
    background: rgba(253, 203, 110, 0.15);
    color: #FDCB6E;
    border: 2px solid #FDCB6E;
}

.mamba2-state-label {
    background: rgba(253, 203, 110, 0.15);
    color: #FDCB6E;
    border: 2px solid #FDCB6E;
}

.mamba2-gate-label {
    background: rgba(253, 121, 168, 0.15);
    color: #FD79A8;
    border: 2px solid #FD79A8;
}

.mamba2-output-label {
    background: rgba(0, 184, 148, 0.15);
    color: #00B894;
    border: 2px solid #00B894;
}

/* CUDA specific labels */
.cuda-grid-label {
    background: #e8f5e9;
    color: #2e7d32;
}

.cuda-blocks-label {
    background: #fff9c4;
    color: #f57f17;
}

.cuda-threads-label {
    background: #ffe0b2;
    color: #e65100;
}

.cuda-shared-label {
    background: #f3e5f5;
    color: #6a1b9a;
}

.cuda-global-label {
    background: #e1f5fe;
    color: #01579b;
}

footer {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}



@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .controls {
        gap: 12px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 0.9em;
        /* Better touch target size for mobile */
        min-height: 44px;
    }
    
    input[type="range"] {
        /* Larger touch target for mobile */
        height: 8px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    .description {
        font-size: 1em;
    }
    
    .homepage-footer {
        padding: 20px 15px;
        font-size: 0.85em;
    }
    
    footer {
        padding: 15px;
        font-size: 0.8em;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 30px 20px;
    }
    
    .hero h1 {
        font-size: 2em;
    }
    
    .hero .subtitle {
        font-size: 1em;
    }
    
    canvas {
        height: 300px;
        min-height: 250px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Device supports only touch input */
    .btn {
        min-height: 44px;
        padding: 14px 24px;
    }
    
    .demo-card {
        /* Ensure adequate spacing for touch */
        margin-bottom: 16px;
    }
    
    input[type="range"] {
        height: 10px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }
}
