* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
 
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow: hidden;
    height: 100vh;
}
 
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 10px;
}
 
header {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}
 
header h1 {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 10px;
    text-align: center;
}
 
.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.eraser-btn {
    background: #FF9800;
}

.eraser-btn:hover {
    background: #F57C00;
}

.eraser-btn.active {
    background: #E65100;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.7);
}

.canvas-size-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.size-input {
    width: 80px;
    padding: 6px 10px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.size-input:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
}

.resize-btn {
    background: #9C27B0;
}

.resize-btn:hover {
    background: #7B1FA2;
}

.pixel-size-display {
    font-size: 13px;
    color: #555;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
}

.pixel-size-display strong {
    color: #9C27B0;
    font-size: 14px;
}
 
.control-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}
 
.control-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
 
.control-btn:active {
    transform: translateY(0);
}
 
.control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}
 
#brushSize {
    width: 100px;
}
 
#brushSizeValue {
    font-weight: bold;
    color: #667eea;
    min-width: 20px;
}
 
.main-content {
    display: flex;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}
 
.toolbar {
    width: 200px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
 
.toolbar::-webkit-scrollbar {
    width: 8px;
}
 
.toolbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
 
.toolbar::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}
 
.category {
    margin-bottom: 20px;
}
 
.category h3 {
    font-size: 16px;
    color: #667eea;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e0e0e0;
}
 
.items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
 
.item-btn {
    padding: 8px 12px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    text-align: left;
    color: #000;
}

.item-btn[data-type="blackhole"],
.item-btn[data-type="bomb"],
.item-btn[data-type="gunpowder"],
.item-btn[data-type="ant"],
.item-btn[data-type="wood"],
.item-btn[data-type="ash"],
.item-btn[data-type="soil"],
.item-btn[data-type="metal"],
.item-btn[data-type="tnt"],
.item-btn[data-type="spider"],
.item-btn[data-type="oil"],
.item-btn[data-type="virus"],
.item-btn[data-type="zombie"],
.item-btn[data-type="corpse"] {
    color: #fff;
}
 
.item-btn:hover {
    transform: translateX(5px);
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
 
.item-btn.active {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    transform: scale(1.05);
}
 
.canvas-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
}
 
#gameCanvas {
    flex: 1;
    border-radius: 8px;
    cursor: crosshair;
    background: #000;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}
 
.info-panel {
    margin-top: 10px;
    display: flex;
    gap: 20px;
    justify-content: center;
    font-size: 13px;
    color: #555;
}
 
.info-panel span {
    display: flex;
    align-items: center;
    gap: 5px;
}
 
.info-panel strong {
    color: #667eea;
}
 
.info-panel strong {
    color: #667eea;
}

/* 移动端菜单切换按钮 */
.menu-toggle-btn {
    display: none;
    position: fixed;
    top: 80px;
    left: 10px;
    z-index: 1001;
    padding: 10px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.menu-toggle-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.menu-toggle-btn.active {
    background: #E65100;
    left: 210px;
}

/* 移动端侧边栏遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .menu-toggle-btn {
        display: block;
    }

    .toolbar {
        position: fixed;
        left: -200px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        width: 200px;
        border-radius: 0;
        transition: left 0.3s ease;
        padding-top: 60px;
    }

    .toolbar.active {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .toolbar {
        width: 160px;
    }
 
    .category h3 {
        font-size: 14px;
    }
 
    .item-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
 
    header h1 {
        font-size: 22px;
    }
}