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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a2e;
    color: #fff;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 10px;
    gap: 10px;
}

#workspace {
    display: flex;
    flex: 1;
    gap: 10px;
    min-height: 0;
}

.panel-title {
    text-align: center;
    padding: 8px;
    background: #0f3460;
    border-bottom: 2px solid #e94560;
    font-size: 14px;
    font-weight: bold;
    color: #eee;
}

#level-selector, #editor-2d, #view-3d {
    background-color: #16213e;
    border: 1px solid #333;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    overflow: hidden;
}

#level-selector {
    width: 70px;
    overflow-y: auto;
}

#levels-container {
    display: flex;
    flex-direction: column-reverse; /* Usually levels stack up */
    align-items: center;
    gap: 10px;
    padding: 15px 0;
}

.level-btn {
    width: 45px;
    height: 45px;
    background: #0f3460;
    border: 2px solid transparent;
    color: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.level-btn:hover {
    background: #1a4a85;
}

.level-btn.active {
    background: #e94560;
    border-color: #fff;
    transform: scale(1.05);
}

#editor-2d {
    flex: 1;
    max-width: 600px;
}

#grid-container {
    display: grid;
    margin: auto;
    border: 1px solid #555;
    background: #111;
    user-select: none;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.grid-cell {
    width: 35px;
    height: 35px;
    border: 1px solid #333;
    background-color: transparent;
    cursor: pointer;
}

.grid-cell:hover {
    border-color: #fff;
}

#view-3d {
    flex: 2;
    position: relative;
    background: #111;
}

#canvas-container {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#canvas-container:active {
    cursor: grabbing;
}

#toolbar {
    height: 70px;
    background-color: #16213e;
    border: 1px solid #333;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#colors-palette {
    display: flex;
    gap: 10px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: #fff;
    transform: scale(1.2);
}

.color-eraser {
    background: repeating-linear-gradient(45deg, #444, #444 5px, #888 5px, #888 10px);
}

#actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

label {
    font-weight: bold;
    font-size: 14px;
}

button {
    padding: 10px 20px;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s ease;
}

button:hover {
    background: #ff5c77;
}

input[type="number"] {
    width: 60px;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    color: #000;
}
