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

body {
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #ddd;
}

#editor-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

#toolbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, rgba(45, 28, 25, 0.98), rgba(35, 20, 18, 0.98));
    border-right: 2px solid #cd853f;
    padding: 15px;
    overflow-y: auto;
    z-index: 100;
}

#toolbar h2 {
    color: #cd853f;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #8b4513;
    letter-spacing: 3px;
}

.section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(139, 69, 19, 0.3);
}

.section label {
    display: block;
    font-size: 11px;
    color: #cd853f;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.btn-group {
    display: flex;
    gap: 5px;
}

.btn-group.vertical {
    flex-direction: column;
}

.btn-group button, .object-list button {
    flex: 1;
    padding: 8px 12px;
    background: linear-gradient(135deg, #5a3d2b, #3d2817);
    border: 1px solid #8b4513;
    border-radius: 4px;
    color: #ddd;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-group button:hover, .object-list button:hover {
    background: linear-gradient(135deg, #7a5d4b, #5d4837);
    border-color: #cd853f;
}

.btn-group button.active, .object-list button.active {
    background: linear-gradient(135deg, #8b4513, #654321);
    border-color: #ffd700;
    color: #ffd700;
}

.object-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.object-list button {
    padding: 10px 8px;
    font-size: 11px;
}

#selected-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #90ee90;
}

.transform-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.control-row span:first-child {
    width: 70px;
    color: #aaa;
}

.control-row input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #3d2817;
    border-radius: 3px;
    cursor: pointer;
}

.control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #cd853f;
    border-radius: 50%;
    cursor: pointer;
}

.control-row input[type="number"] {
    width: 60px;
    padding: 4px 8px;
    background: #3d2817;
    border: 1px solid #8b4513;
    border-radius: 4px;
    color: #ddd;
    font-size: 12px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 8px;
}

.option-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

select {
    width: 100%;
    padding: 8px;
    background: #3d2817;
    border: 1px solid #8b4513;
    border-radius: 4px;
    color: #ddd;
    font-size: 12px;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #cd853f;
}

#status-bar {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    height: 30px;
    background: rgba(45, 28, 25, 0.95);
    border-top: 1px solid #8b4513;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 30px;
    font-size: 12px;
    z-index: 100;
}

#status-bar span {
    color: #aaa;
}

#status-bar #mouse-pos {
    color: #90ee90;
    min-width: 120px;
}

#status-bar #object-count {
    color: #ffd700;
}

#status-bar #help {
    margin-left: auto;
    color: #888;
}

/* Modal */
#modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #3e2723, #2d1c19);
    border: 2px solid #cd853f;
    border-radius: 10px;
    padding: 25px;
    min-width: 300px;
}

.modal-content h3 {
    color: #cd853f;
    margin-bottom: 15px;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 10px;
    background: #1a1a2e;
    border: 1px solid #8b4513;
    border-radius: 5px;
    color: #ddd;
    font-size: 14px;
    margin-bottom: 15px;
}

.modal-content input[type="text"]:focus {
    outline: none;
    border-color: #cd853f;
}

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

.modal-buttons button {
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

#modal-cancel {
    background: #555;
    border: 1px solid #777;
    color: #ddd;
}

#modal-cancel:hover {
    background: #666;
}

#modal-confirm {
    background: linear-gradient(135deg, #8b4513, #654321);
    border: 1px solid #cd853f;
    color: #fff;
}

#modal-confirm:hover {
    background: linear-gradient(135deg, #a0522d, #8b4513);
}

/* Grid helper visual */
.grid-overlay {
    pointer-events: none;
}

/* Terrain section */
.sub-label {
    font-size: 10px;
    color: #999;
    margin: 10px 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sub-label.help-text {
    color: #90ee90;
    font-style: italic;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 15px;
}

.terrain-base {
    margin-bottom: 10px;
}

.terrain-btn {
    flex: 1;
}

.terrain-btn[data-base="grass"].active {
    border-color: #90ee90;
    color: #90ee90;
}

.terrain-btn[data-base="road"].active {
    border-color: #d4a574;
    color: #d4a574;
}

.terrain-btn[data-base="water"].active {
    border-color: #6bb3f0;
    color: #6bb3f0;
}

#cell-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #90ee90;
    line-height: 1.6;
}

#cell-info .cell-coord {
    color: #ffd700;
    font-weight: bold;
}

#cell-info .cell-height {
    color: #6bb3f0;
}

#cell-info .cell-base {
    color: #d4a574;
}

/* Mode sections toggle */
#terrain-section, #objects-section {
    transition: opacity 0.2s;
}

/* Selected cell highlight */
.cell-highlight {
    position: absolute;
    pointer-events: none;
    border: 2px solid #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

/* Special terraform button */
.btn-special {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #2d5a27, #1a3d15);
    border: 2px solid #4a9f41;
    border-radius: 6px;
    color: #90ee90;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-special:hover {
    background: linear-gradient(135deg, #3d7a37, #2a5d25);
    border-color: #90ee90;
    box-shadow: 0 0 15px rgba(144, 238, 144, 0.3);
}

/* Paint mode buttons */
.paint-mode {
    margin-bottom: 10px;
}

/* Texture buttons */
.texture-group {
    margin-bottom: 5px;
}

.texture-btn[data-texture="grass"].active {
    border-color: #90ee90;
    color: #90ee90;
}

.texture-btn[data-texture="road"].active {
    border-color: #d4a574;
    color: #d4a574;
}

.texture-btn[data-texture="water"].active {
    border-color: #6bb3f0;
    color: #6bb3f0;
}

/* Color picker */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.color-picker-row input[type="color"] {
    width: 60px;
    height: 35px;
    padding: 0;
    border: 2px solid #8b4513;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

#color-preview {
    flex: 1;
    height: 35px;
    border: 2px solid #8b4513;
    border-radius: 4px;
    background: #4a7c59;
}

/* Color presets */
.color-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.color-preset {
    width: 100%;
    height: 30px;
    border: 2px solid #5a3d2b;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-preset:hover {
    border-color: #ffd700;
    transform: scale(1.05);
}

/* Transform controls in terrain section */
.transform-controls {
    margin-top: 10px;
}
