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

:root {
    --primary-gradient: linear-gradient(135deg, #6B3FE8 0%, #9B59F5 100%);
    --secondary-gradient: linear-gradient(135deg, #FF4D6D 0%, #FF7D3B 100%);
    --accent-color: #FFD93D;
    --success-color: #06D6A0;
    --level1-color: #118CFF;
    --level2-color: #FF7D3B;
    --level3-color: #3BB54A;
    --level4-color: #9B59F5;
    --dark-bg: #2D2255;
    --card-bg: #4A4070;
    --text-primary: #F9F7FF;
    --text-secondary: #F0ECFF;
    --border-color: #3D3265;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: linear-gradient(to bottom, rgba(26, 26, 46, 0.95), transparent);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
}

.logo-icon {
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(107, 63, 232, 0.1);
}

.nav-btn.active {
    color: var(--text-primary);
    background: rgba(107, 63, 232, 0.2);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.settings-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.settings-btn:hover {
    transform: rotate(20deg);
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.view {
    display: none;
    animation: fadeIn 0.5s ease;
}

.view.active {
    display: block;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
    align-items: center;
}

.hero-content {
    z-index: 10;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.cta-btn {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: var(--primary-gradient);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(107, 63, 232, 0.3);
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(107, 63, 232, 0.4);
}

.hero-animation {
    position: relative;
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(107, 63, 232, 0.1), rgba(255, 77, 109, 0.1));
    border: 1px solid var(--border-color);
}

#heroCanvas {
    width: 100%;
    height: 100%;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-card:hover {
    border-color: var(--primary-gradient);
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(107, 63, 232, 0.2);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.featured-section {
    margin-bottom: 3rem;
}

.featured-section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.levels-container {
    max-width: 1200px;
    margin: 0 auto;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.level-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: currentColor;
}

.level-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-color: currentColor;
}

.level-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.level-badge {
    font-size: 2rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.level-number {
    font-size: 3rem;
    font-weight: 700;
    opacity: 0.2;
}

.level-card-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.level-card-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.level-card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.simulations-count {
    display: inline-block;
    background: rgba(107, 63, 232, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--primary-gradient);
}

.level-header {
    background: linear-gradient(135deg, rgba(107, 63, 232, 0.2), rgba(255, 77, 109, 0.2));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    margin-bottom: 3rem;
    text-align: center;
}

.level-header h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.level-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

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

.simulation-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.simulation-card:hover {
    transform: translateY(-8px);
    border-color: var(--text-primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.sim-icon {
    font-size: 3rem;
    text-align: center;
}

.sim-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.sim-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    flex: 1;
}

.sim-difficulty {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    background: rgba(107, 63, 232, 0.2);
    width: fit-content;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border: none;
    border-radius: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    max-width: none;
    max-height: 100vh;
}

#simulationContent {
    flex: 1;
    width: 100%;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

#simulationContent > div {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

#simulation-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
}

#simulation-content > div {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    overflow: auto;
    width: 100%;
}

.tree-explorer-container,
.chatbot-container,
.pattern-ai-container,
.image-sorting-container,
.logic-circuits-container,
.iot-simulator-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-height: 100%;
    overflow: hidden;
    gap: 0;
    padding: 0.5rem;
    margin: 0;
}

.pattern-header,
.circuits-header,
.chatbot-header,
.tree-header,
.image-header,
.iot-header {
    padding: 1rem;
    background: linear-gradient(135deg, rgba(107, 63, 232, 0.1), rgba(255, 77, 109, 0.1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex-shrink: 0;
    overflow-y: auto;
}

.pattern-header h2,
.pattern-header h3,
.circuits-header h2,
.circuits-header h3,
.chatbot-header h2,
.chatbot-header h3,
.tree-header h2,
.tree-header h3,
.image-header h2,
.image-header h3,
.iot-header h2,
.iot-header h3 {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    margin: 0 0 0.5rem 0;
}

.pattern-header p,
.circuits-header p,
.chatbot-header p,
.tree-header p,
.image-header p,
.iot-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pattern-stats,
.circuits-stats,
.chatbot-stats,
.sorting-stats,
.iot-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0;
}

.stat-box {
    background: rgba(0, 0, 0, 0.3);
    padding: clamp(0.2rem, 1vw, 0.5rem) clamp(0.4rem, 1.5vw, 0.8rem);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(0.65rem, 1.5vw, 0.85rem);
    gap: clamp(0.2rem, 0.8vw, 0.5rem);
    white-space: nowrap;
}

.pattern-content,
.circuits-workspace,
.chatbot-content,
.chatbot-main,
.tree-content,
.tree-main,
.image-content,
.sorting-main,
.iot-content,
.iot-main {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    flex: 1;
    overflow: hidden;
    padding: 0;
    margin: 0;
    width: 100%;
    min-height: 0;
}

.visualization-panel,
.gate-controls-panel,
.chatbot-panel,
.tree-panel,
.image-panel,
.iot-panel,
.avatar-chat-panel,
.image-pool-panel {
    flex: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.control-panel,
.interaction-panel,
.rule-management-panel,
.tree-interaction-panel {
    flex: 0 0 clamp(180px, 25vw, 320px);
    min-width: 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.visualization-content {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

canvas {
    max-width: 100%;
    height: auto;
}

.pattern-footer,
.circuits-footer {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    flex-shrink: 0;
}

.tab-buttons {
    display: flex;
    gap: clamp(0.2rem, 1vw, 0.5rem);
    margin-bottom: clamp(0.3rem, 1vw, 0.75rem);
    flex-wrap: wrap;
}

.tab-btn {
    padding: clamp(0.25rem, 0.8vw, 0.4rem) clamp(0.5rem, 1.5vw, 1rem);
    background: rgba(107, 63, 232, 0.2);
    border: 1px solid rgba(107, 63, 232, 0.5);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: clamp(0.65rem, 1.5vw, 0.9rem);
}

.tab-btn:hover,
.tab-btn.active {
    background: rgba(107, 63, 232, 0.5);
    border-color: var(--primary-color);
}

@media (max-width: 1200px) {
    .pattern-content,
    .circuits-workspace,
    .chatbot-content,
    .chatbot-main,
    .tree-content,
    .tree-main,
    .image-content,
    .image-sorting-container,
    .iot-content,
    .iot-main {
        flex-direction: column;
    }
    
    .control-panel,
    .interaction-panel,
    .rule-management-panel,
    .tree-interaction-panel,
    .gate-controls-panel,
    .chatbot-panel,
    .tree-panel,
    .image-panel,
    .iot-panel,
    .avatar-chat-panel,
    .image-pool-panel {
        flex: 1;
        flex-basis: auto;
        min-height: 200px;
        max-height: 250px;
    }
    
    .visualization-panel {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        padding: 0;
        max-height: 100vh;
        width: 100vw;
    }
    
    .pattern-header,
    .circuits-header,
    .chatbot-header,
    .tree-header,
    .image-header,
    .iot-header {
        padding: 0.75rem;
    }
    
    .pattern-stats,
    .circuits-stats,
    .chatbot-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .pattern-content,
    .circuits-workspace,
    .chatbot-main,
    .tree-main,
    .image-sorting-container,
    .iot-main {
        gap: 0.5rem;
        padding: 0;
        flex-direction: column;
    }
    
    .control-panel,
    .interaction-panel,
    .rule-management-panel,
    .avatar-chat-panel,
    .image-pool-panel,
    .tree-interaction-panel,
    .gate-controls-panel,
    .chatbot-panel,
    .tree-panel,
    .image-panel,
    .iot-panel {
        flex: 1;
        min-height: 180px;
        max-height: none;
    }
    
    .tab-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
    
    .visualization-panel {
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 0;
        width: 100vw;
        height: 100vh;
    }
    
    .pattern-header,
    .circuits-header,
    .chatbot-header,
    .tree-header,
    .image-header,
    .iot-header {
        padding: 0.5rem;
    }
    
    .pattern-header h2,
    .pattern-header h3,
    .circuits-header h2,
    .circuits-header h3,
    .chatbot-header h2,
    .chatbot-header h3,
    .tree-header h2,
    .tree-header h3,
    .image-header h2,
    .image-header h3,
    .iot-header h2,
    .iot-header h3 {
        font-size: 1rem;
        margin: 0;
    }
    
    .pattern-stats,
    .circuits-stats,
    .chatbot-stats {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    
    .stat-box {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
        gap: 0.2rem;
    }
    
    .pattern-content,
    .circuits-workspace,
    .chatbot-main,
    .tree-main,
    .image-sorting-container,
    .iot-main {
        gap: 0.3rem;
        padding: 0;
    }
    
    .control-panel,
    .interaction-panel,
    .rule-management-panel,
    .avatar-chat-panel,
    .image-pool-panel,
    .tree-interaction-panel,
    .gate-controls-panel,
    .chatbot-panel,
    .tree-panel,
    .image-panel,
    .iot-panel,
    .visualization-panel {
        flex: 1;
        min-height: 120px;
        padding: 0.4rem;
    }
    
    .tab-btn {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
        margin-bottom: 0.25rem;
    }
}

.modal-close {
    position: fixed;
    right: clamp(0.5rem, 2vw, 2rem);
    top: clamp(0.5rem, 2vw, 2rem);
    background: rgba(255, 77, 109, 0.2);
    border: 2px solid #FF4D6D;
    color: #FF4D6D;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    width: clamp(40px, 10vw, 60px);
    height: clamp(40px, 10vw, 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 77, 109, 0.4);
    transform: scale(1.1);
}

.progress-container {
    max-width: 1200px;
    margin: 0 auto;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.progress-chart-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 3rem;
    position: relative;
    height: 400px;
}

.about-container {
    max-width: 900px;
    margin: 0 auto;
}

.about-container h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.about-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

.about-content h3 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.5rem 0;
    color: var(--text-primary);
}

.about-content p, .about-content ul {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.about-content ul {
    margin-left: 1.5rem;
}

.about-content li {
    margin-bottom: 0.5rem;
}

footer {
    background: linear-gradient(to top, rgba(26, 26, 46, 0.95), transparent);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.level-1-color {
    border-top-color: var(--level1-color) !important;
}

.level-2-color {
    border-top-color: var(--level2-color) !important;
}

.level-3-color {
    border-top-color: var(--level3-color) !important;
}

.level-4-color {
    border-top-color: var(--level4-color) !important;
}

@media (max-width: 768px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .simulations-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 1rem;
    }
}

.level-card-title, .sim-name {
    color: var(--text-primary);
}

.progress-badge {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #FFD93D, #FF7D3B);
    border-radius: 20px;
    margin: 0.5rem;
    font-weight: 600;
}

button {
    font-size: clamp(0.75rem, 2vw, 1rem);
    padding: clamp(0.4rem, 1.5vw, 0.75rem) clamp(0.6rem, 2vw, 1.2rem);
    transition: all 0.2s ease;
}

.hidden {
    display: none !important;
}

/* Responsive button styles for level 2 simulations */
.add-rule-btn,
.remove-rule-btn,
.clear-rules-btn,
.submit-answer-btn,
.try-again-btn,
.next-pattern-btn,
.send-message-btn,
.reset-btn,
.add-gate-btn,
.remove-gate-btn {
    padding: clamp(0.4rem, 1.5vw, 0.7rem) clamp(0.8rem, 2.5vw, 1.5rem);
    font-size: clamp(0.8rem, 1.8vw, 1rem);
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(107, 63, 232, 0.3);
    color: var(--text-primary);
    white-space: nowrap;
}

.add-rule-btn:hover,
.remove-rule-btn:hover,
.clear-rules-btn:hover,
.submit-answer-btn:hover,
.try-again-btn:hover,
.next-pattern-btn:hover,
.send-message-btn:hover,
.reset-btn:hover,
.add-gate-btn:hover,
.remove-gate-btn:hover {
    background: rgba(107, 63, 232, 0.6);
    transform: translateY(-2px);
}

/* Input fields responsive sizing */
input,
textarea,
select {
    font-size: clamp(0.8rem, 1.8vw, 1rem);
    padding: clamp(0.3rem, 1vw, 0.6rem);
}

/* Canvas responsive sizing */
canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Ensure all simulation content takes full available space */
.webgl-canvas,
.canvas-container,
.visualization-canvas {
    width: 100%;
    height: 100%;
    min-height: 150px;
}

/* IMAGE SORTING STYLES */
.iso-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(6, 214, 160, 0.1), rgba(255, 77, 109, 0.1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.iso-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.iso-stats {
    display: flex;
    gap: 2rem;
}

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

.iso-stat span:first-child {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.iso-stat span:last-child {
    font-size: 1.2rem;
    font-weight: 600;
    color: #06D6A0;
}

.iso-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.iso-left, .iso-right {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.iso-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.iso-image-item {
    background: rgba(107, 63, 232, 0.1);
    border: 2px solid rgba(107, 63, 232, 0.3);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: grab;
    transition: all 0.2s ease;
}

.iso-image-item:hover {
    border-color: #06D6A0;
    background: rgba(6, 214, 160, 0.1);
    transform: translateY(-2px);
}

.iso-image-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.iso-image-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.iso-buckets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.iso-bucket {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #6B3FE8;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 150px;
}

.iso-bucket-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.iso-bucket-emoji {
    font-size: 1.5rem;
}

.iso-bucket-items {
    flex: 1;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.iso-empty-msg {
    color: var(--text-secondary);
    margin: 0;
}

.iso-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.iso-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid rgba(107, 63, 232, 0.3);
    background: rgba(107, 63, 232, 0.1);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.iso-btn:hover {
    background: rgba(107, 63, 232, 0.3);
}

.iso-btn-primary {
    background: linear-gradient(135deg, #6B3FE8, #9B59F5);
    border-color: transparent;
}

.iso-btn-primary:hover {
    transform: translateY(-2px);
}

/* LOGIC CIRCUITS STYLES */
.lc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 217, 61, 0.1), rgba(255, 77, 109, 0.1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.lc-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.lc-stats {
    display: flex;
    gap: 2rem;
}

.lc-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lc-stat span:first-child {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lc-stat span:last-child {
    font-size: 1.2rem;
    font-weight: 600;
    color: #FFD93D;
}

.lc-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.lc-left, .lc-right {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.lc-gates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.lc-gate-btn {
    background: rgba(107, 63, 232, 0.1);
    border: 1px solid rgba(107, 63, 232, 0.3);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.lc-gate-btn:hover {
    background: rgba(107, 63, 232, 0.2);
    border-color: #6B3FE8;
}

.lc-gate-icon {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6B3FE8;
}

.lc-gate-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.lc-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.lc-input-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lc-input-item label {
    flex: 0 0 auto;
    min-width: 100px;
}

.lc-toggle {
    flex: 1;
    padding: 0.5rem;
    background: rgba(255, 77, 109, 0.2);
    border: 1px solid rgba(255, 77, 109, 0.5);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.lc-toggle[data-state="1"] {
    background: rgba(6, 214, 160, 0.2);
    border-color: rgba(6, 214, 160, 0.5);
}

.lc-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.lc-tab-btn {
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lc-tab-btn.active {
    color: #6B3FE8;
    border-bottom-color: #6B3FE8;
}

.lc-tab-content {
    flex: 1;
    overflow-y: auto;
}

.lc-gates-list, .lc-outputs-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lc-gate-item, .lc-output-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lc-output-value {
    font-weight: 600;
}

.lc-truth-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.lc-truth-table th, .lc-truth-table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: center;
}

.lc-truth-table th {
    background: rgba(107, 63, 232, 0.2);
    font-weight: 600;
}

.lc-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.lc-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid rgba(107, 63, 232, 0.3);
    background: rgba(107, 63, 232, 0.1);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lc-btn:hover {
    background: rgba(107, 63, 232, 0.3);
}

.lc-btn-primary {
    background: linear-gradient(135deg, #6B3FE8, #9B59F5);
    border-color: transparent;
}

.lc-btn-primary:hover {
    transform: translateY(-2px);
}

.lc-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem 0;
}

/* IoT SIMULATOR STYLES */
.iot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(6, 214, 160, 0.1), rgba(147, 225, 211, 0.1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.iot-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.iot-stats {
    display: flex;
    gap: 2rem;
}

.iot-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.iot-stat span:first-child {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.iot-stat span:last-child {
    font-size: 1.2rem;
    font-weight: 600;
}

.iot-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.iot-left, .iot-right {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.iot-devices-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.iot-device-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(6, 214, 160, 0.3);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.iot-device-card:hover {
    border-color: #06D6A0;
    background: rgba(6, 214, 160, 0.1);
}

.iot-device-icon {
    font-size: 1.5rem;
}

.iot-device-info {
    flex: 1;
}

.iot-device-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.iot-device-type {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.iot-device-control {
    display: flex;
    align-items: center;
}

.iot-toggle {
    padding: 0.5rem 1rem;
    background: rgba(255, 77, 109, 0.2);
    border: 1px solid rgba(255, 77, 109, 0.5);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.iot-toggle.iot-toggle-on {
    background: rgba(6, 214, 160, 0.2);
    border-color: rgba(6, 214, 160, 0.5);
    color: #06D6A0;
}

.iot-sensor-value {
    font-weight: 600;
    color: #06D6A0;
}

.iot-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.iot-tab-btn {
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.iot-tab-btn.active {
    color: #06D6A0;
    border-bottom-color: #06D6A0;
}

.iot-tab-content {
    flex: 1;
    overflow-y: auto;
}

.iot-monitor {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.iot-monitor-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.iot-monitor-item span:first-child {
    color: var(--text-secondary);
}

.iot-monitor-item span:last-child {
    font-weight: 600;
    color: #06D6A0;
}

.iot-form {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.iot-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.iot-form-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

.iot-select, .iot-input {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(107, 63, 232, 0.3);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.iot-select:focus, .iot-input:focus {
    outline: none;
    border-color: #6B3FE8;
    background: rgba(107, 63, 232, 0.1);
}

.iot-btn {
    padding: 0.75rem;
    background: rgba(107, 63, 232, 0.1);
    border: 1px solid rgba(107, 63, 232, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.iot-btn:hover {
    background: rgba(107, 63, 232, 0.3);
}

.iot-btn-primary {
    background: linear-gradient(135deg, #06D6A0, #44b3a8);
    border-color: transparent;
    color: #2D2255;
}

.iot-btn-primary:hover {
    transform: translateY(-2px);
}

.iot-rules-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.iot-rule-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid #06D6A0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.iot-rule-text {
    flex: 1;
    font-size: 0.9rem;
}

.iot-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem 0;
}

/* IMAGE SORTING ADDITIONAL STYLES */
.iso-progress-bar {
    background: rgba(0, 0, 0, 0.3);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.iso-progress-fill {
    background: linear-gradient(90deg, #06D6A0, #6B3FE8);
    height: 100%;
    transition: width 0.3s ease;
}

.iso-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* LOGIC CIRCUITS ADDITIONAL STYLES */
.lc-progress {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.lc-progress-bar {
    background: rgba(0, 0, 0, 0.3);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.lc-progress-fill {
    background: linear-gradient(90deg, #FFD93D, #6B3FE8);
    height: 100%;
    transition: width 0.3s ease;
}

.lc-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: -0.5rem;
}

.lc-quick-test {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.lc-quick-test h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.lc-quick-btn {
    padding: 0.5rem 0.75rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    background: rgba(107, 63, 232, 0.1);
    border: 1px solid rgba(107, 63, 232, 0.3);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.lc-quick-btn:hover {
    background: rgba(107, 63, 232, 0.2);
    border-color: #6B3FE8;
}

.lc-history-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: 6px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.lc-history-input {
    font-size: 0.9rem;
    font-weight: 600;
}

.lc-history-output {
    display: flex;
    gap: 0.25rem;
}

.lc-history-value {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.lc-history-value.true {
    background: rgba(6, 214, 160, 0.3);
    color: #06D6A0;
}

.lc-history-value.false {
    background: rgba(255, 77, 109, 0.3);
    color: #FF4D6D;
}

.lc-history-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.lc-truth-true {
    color: #06D6A0;
    font-weight: 600;
}

.lc-truth-false {
    color: #FF4D6D;
    font-weight: 600;
}

.lc-value {
    font-weight: 600;
    color: #6B3FE8;
    margin-left: 0.5rem;
}

/* IoT SIMULATOR ADDITIONAL STYLES */
.iot-progress {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.iot-progress-bar {
    background: rgba(0, 0, 0, 0.3);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.iot-progress-fill {
    background: linear-gradient(90deg, #06D6A0, #3BB54A);
    height: 100%;
    transition: width 0.3s ease;
}

.iot-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: -0.5rem;
}

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

.iot-sensor-display {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-weight: 600;
}

.iot-sensor-value {
    font-size: 1.3rem;
    color: #06D6A0;
}

.iot-sensor-unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.iot-sensor-trend {
    font-size: 1.1rem;
}

.iot-monitor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.iot-monitor-card {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid #06D6A0;
}

.iot-monitor-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.iot-monitor-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #06D6A0;
    margin-bottom: 0.5rem;
}

.iot-monitor-bar {
    background: rgba(0, 0, 0, 0.5);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.iot-monitor-bar-fill {
    background: linear-gradient(90deg, #06D6A0, #6B3FE8);
    height: 100%;
    transition: width 0.3s ease;
}

.iot-monitor-trend {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.iot-monitor-status {
    font-size: 0.85rem;
    font-weight: 600;
}

.iot-power-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid #6B3FE8;
}

.iot-power-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.iot-rule-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid #06D6A0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.iot-rule-content {
    flex: 1;
}

.iot-rule-number {
    display: inline-block;
    background: rgba(6, 214, 160, 0.2);
    color: #06D6A0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.iot-rule-text {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.iot-rule-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.iot-delete-rule {
    background: none;
    border: none;
    color: #FF4D6D;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.iot-delete-rule:hover {
    transform: scale(1.3);
}

.iot-logs-filter {
    margin-bottom: 1rem;
}

.iot-log-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 77, 109, 0.1);
    border: 1px solid rgba(255, 77, 109, 0.3);
    border-radius: 4px;
    color: #FF4D6D;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.iot-log-btn:hover {
    background: rgba(255, 77, 109, 0.2);
}

.iot-log-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #6B3FE8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.iot-log-time {
    color: var(--text-secondary);
    font-size: 0.85rem;
    min-width: 80px;
}

.iot-log-message {
    flex: 1;
    margin-left: 1rem;
}

@media (max-width: 1024px) {
    .iso-content,
    .lc-content,
    .iot-content {
        grid-template-columns: 1fr;
    }
    
    .iso-images {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .lc-gates-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .iot-monitor-grid {
        grid-template-columns: 1fr;
    }
}
