* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #222;
    color: #eee;
    font-family: sans-serif;
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

canvas {
    border: none;
    background-color: #111;
    image-rendering: pixelated;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

#elementDrawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 140px;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    transition: left 0.3s;
    color: white;
    border-right: 2px solid #444;
    font-family: monospace;
    z-index: 1000;
    overflow: visible;
}

#elementDrawer.closed {
    left: -140px;
}

#toggleElements {
    position: absolute;
    left: 100%;
    top: 10px;
    width: auto;
    height: 40px;
    padding: 0 15px;
    background: #333;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 0 5px 5px 0;
    font-size: 20px;
    white-space: nowrap;
}

#elementContent {
    height: 100%;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.element-btn {
    padding: 10px;
    border: 4px solid;
    border-color: rgba(255, 255, 255, 0.4) rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.4) rgba(255, 255, 255, 0.4);
    border-radius: 0;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    text-transform: uppercase;
    transition: transform 0.1s;
    color: white;
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.2), rgba(0,0,0,0.2));
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
    margin-bottom: 4px;
}

.element-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

.element-btn.selected {
    border-color: white;
    transform: scale(1.05);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5), 0 0 0 2px black;
    z-index: 1;
}

#settingsDrawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    transition: right 0.3s;
    color: white;
    border-left: 2px solid #444;
    font-family: monospace;
    z-index: 1000;
    overflow: visible;
}

#settingsDrawer.open {
    right: 0;
}

#toggleDrawer {
    position: absolute;
    left: auto;
    right: 100%;
    top: 10px;
    width: auto;
    height: 40px;
    padding: 0 15px;
    background: #333;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 5px 0 0 5px;
    font-size: 20px;
    white-space: nowrap;
}

#togglePause {
    position: absolute;
    left: auto;
    right: 100%;
    top: 60px;
    width: 120px;
    height: 120px;
    padding: 0;
    background: #333;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 5px 0 0 5px;
    font-size: 60px;
}

.setting-group {
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.setting-group h3, .setting-group fieldset {
    width: 100%;
}

#settingsContent {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

.setting-control {
    display: grid;
    grid-template-columns: 1.5fr 2fr 1fr;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    width: 100%;
}

.setting-control input[type=range] {
    width: 100%;
}

.setting-checkbox {
    display: flex;
    align-items: center;
    width: calc(50% - 5px);
    font-size: 12px;
}

@media (max-width: 768px) {
    #elementDrawer {
        width: 120px;
    }
    #elementDrawer.closed {
        left: -120px;
    }
    #settingsDrawer {
        width: 250px;
        right: -250px;
    }
    #settingsDrawer.open {
        right: 0;
    }
    .setting-checkbox {
        width: 100%;
    }
}