:root {
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --accent-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.sim-header {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.sim-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sim-title i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.sim-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.back-btn {
    background: #e2e8f0;
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #cbd5e1;
    transform: translateX(5px);
}

.main-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 25px;
    flex: 1;
}

.controls-panel {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    height: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.simulation-panel {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow-x: auto;
    max-width: 100%;
}

.control-group {
    margin-bottom: 25px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.control-group .value {
    color: var(--primary-color);
    font-weight: 700;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 5px;
    appearance: none;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
    transition: 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid #e2e8f0;
    padding: 10px 24px;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    width: 100%;
    margin-top: 25px;
}

.stat-item {
    background: rgba(241, 245, 249, 0.5);
    padding: 15px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .controls-panel {
        order: 2;
    }
    
    .simulation-panel {
        order: 1;
        min-height: 400px;
    }
    
    .sim-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
        overflow-x: clip;
    }
    
    .controls-panel, .simulation-panel {
        padding: 15px;
        width: 100%;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .simulation-panel > *:first-child {
        transform: scale(0.9);
        transform-origin: top center;
    }
}

/* Classroom Smartboards & 4K for simulations */
@media (min-width: 1800px) {
    .main-container {
        max-width: 1750px;
        gap: 30px;
    }
    .simulation-panel {
        min-height: 600px;
    }
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Hide teacher badge, sound button and presentation mode from header */
.teacher-badge,
.badge-teacher,
.teacher-tag,
.btn-head.btn-sound,
#soundToggleBtn,
#btnSound,
#btnTheme,
button[onclick*="toggleTheme"],
button[onclick*="toggleDayMode"],
button[onclick*="toggleAudio"],
button[onclick*="toggleSound"] {
    display: none !important;
}

html.is-embedded header,
html.is-embedded .top-navbar,
html.is-embedded .lab-navbar,
html.is-embedded .sim-header,
html.is-embedded .game-header,
html.is-embedded .header-bar,
html.is-embedded .header-info,
body.in-iframe header,
body.in-iframe .top-navbar,
body.in-iframe .lab-navbar,
body.in-iframe .sim-header {
    display: none !important;
}
