#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0f172a;
    transform-origin: top left;
}

.sim-container {
    display: flex;
    flex: 1;
    width: 100%;
    gap: 15px;
    padding: 15px;
    box-sizing: border-box;
}

.controls-wrapper {
    flex: 0 0 300px;
    width: 300px;
    max-height: calc(720px - 100px);
    background: #1e293b;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    color: #e2e8f0;
    border: 1px solid #334155;
    position: relative;
    box-sizing: border-box;
}

/* Custom Scrollbar for the sidebar */
.controls-wrapper::-webkit-scrollbar {
    width: 6px;
}
.controls-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}
.controls-wrapper::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}
.controls-wrapper::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

@media (max-width: 1024px) {
    .controls-wrapper {
        min-width: 240px;
        max-width: 260px;
        padding: 12px;
        gap: 10px;
    }
}

.canvas-wrapper {
    position: relative;
    flex: 3;
    /* Space Nebula Gradient */
    background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 70%, #000000 100%);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    border: 2px solid #334155;
    display: flex;
}

canvas#simCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

canvas#simCanvas:active {
    cursor: grabbing;
}

/* Panel & Controls Styling */
.ph-panel {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 12px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.panel-dark {
    background: #0f172a;
}

.panel-darker {
    background: #020617;
    border-color: #1e293b;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group input[type="range"] {
    width: 100%;
    accent-color: #38bdf8;
    cursor: pointer;
}

.dark-input {
    background: #1e293b;
    border: 1px solid #475569;
    color: #f8fafc;
    padding: 6px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

input.dark-input:focus,
select.dark-input:focus {
    outline: none;
    border-color: #38bdf8;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #cbd5e1;
    cursor: pointer;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 8px;
}

.btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    transition: 0.2s;
    text-align: center;
}

.btn-fire {
    background: #10b981;
}

.btn-fire:hover {
    background: #059669;
}

.btn-clear {
    background: #475569;
}

.btn-clear:hover {
    background: #334155;
}

.btn-outline {
    background: transparent;
    border: 1px solid #475569;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* HUD Overlay */
.hud-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid #334155;
    padding: 10px 15px;
    border-radius: 6px;
    pointer-events: none;
    min-width: 150px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}