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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    top: unset;
}

button {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 14px;
}

button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

button:active {
    transform: translateY(0);
}

#canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    background: radial-gradient(circle at center, #0a0a0a 0%, #000000 100%);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    backdrop-filter: none;
}

.modal-content {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    padding: 40px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 700px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
}

h2 {
    margin-bottom: 30px;
    font-size: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #cccccc;
}

.rules-section {
    margin-bottom: 30px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.checkbox-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.checkbox-item input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    margin-bottom: 5px;
}

.checkbox-item input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
}

.checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-item label {
    font-size: 14px;
    color: #cccccc;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

#resetRulesBtn {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.3);
}

#resetRulesBtn:hover {
    background: rgba(255, 0, 0, 0.3);
}

.preset-section {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.preset-section label {
    font-size: 16px;
    color: #cccccc;
}

#presetSelect {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
}

#presetSelect option {
    background: #1a1a1a;
    color: #ffffff;
}

#savePresetBtn, #loadPresetBtn {
    padding: 8px 16px;
    font-size: 14px;
    margin-left: 5px;
}

@media (max-width: 600px) {
    #controls {
        top: 10px;
        left: 10px;
        right: 10px;
        justify-content: center;
    }
    
    button {
        font-size: 12px;
        padding: 10px 16px;
    }
}