* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 100%);
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#status-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px;
    background: rgba(139, 69, 19, 0.9);
    border-bottom: 3px solid #8B4513;
    color: #FFD700;
    font-size: 14px;
    font-weight: bold;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon {
    font-size: 16px;
}

.save-btn {
    background: #228B22;
    color: white;
    border: 2px solid #006400;
    border-radius: 5px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    transition: all 0.2s;
}

.save-btn:hover {
    background: #32CD32;
}

.save-btn:active {
    transform: scale(0.95);
}

#gameCanvas {
    flex: 1;
    display: block;
    image-rendering: pixelated;
    touch-action: none;
}

#toolbar {
    background: rgba(139, 69, 19, 0.95);
    border-top: 3px solid #8B4513;
    padding: 8px;
    max-height: 35vh;
    overflow-y: auto;
}

.toolbar-section {
    margin-bottom: 8px;
}

.toolbar-section h3 {
    color: #FFD700;
    font-size: 12px;
    margin-bottom: 6px;
    text-align: center;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.tool-btn {
    background: #DEB887;
    border: 3px solid #8B4513;
    border-radius: 8px;
    padding: 6px 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 60px;
}

.tool-btn:active {
    transform: scale(0.95);
}

.tool-btn.selected {
    border-color: #FFD700;
    background: #F4A460;
    box-shadow: 0 0 10px #FFD700;
}

.tool-btn.locked {
    opacity: 0.5;
    background: #A0522D;
}

.lock-icon {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
}

.tool-icon {
    font-size: 24px;
    line-height: 1;
}

.tool-name {
    font-size: 10px;
    color: #8B4513;
    margin-top: 2px;
    font-weight: bold;
}

.tool-cost {
    font-size: 9px;
    color: #228B22;
    font-weight: bold;
}

#floating-text {
    position: absolute;
    pointer-events: none;
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 0 #8B4513, -2px -2px 0 #8B4513,
                 2px -2px 0 #8B4513, -2px 2px 0 #8B4513;
    animation: floatUp 1.5s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px);
    }
}

#toolbar::-webkit-scrollbar {
    width: 8px;
}

#toolbar::-webkit-scrollbar-track {
    background: #8B4513;
}

#toolbar::-webkit-scrollbar-thumb {
    background: #DEB887;
    border-radius: 4px;
}

@media (max-width: 360px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .tool-btn {
        min-height: 55px;
        padding: 4px 2px;
    }
    .tool-icon {
        font-size: 20px;
    }
    .tool-name {
        font-size: 9px;
    }
}
