* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #fff;
}

.game-container {
    position: relative;
    background: #1a1a2e;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#gameCanvas {
    display: block;
    background: #87CEEB;
    border: 3px solid #4a4a6e;
    border-radius: 5px;
    cursor: crosshair;
}

.hud {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 20px;
}

.stats {
    flex: 1;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.stat-label {
    min-width: 60px;
    font-weight: bold;
}

.stat-bar {
    flex: 1;
    height: 20px;
    background: #2a2a3e;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #4a4a6e;
}

.stat-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.stat-item:nth-child(1) .stat-fill {
    background: linear-gradient(90deg, #ff4444, #ff6666);
}

.stat-item:nth-child(2) .stat-fill {
    background: linear-gradient(90deg, #ffaa00, #ffcc44);
}

.stat-item:nth-child(3) .stat-fill {
    background: linear-gradient(90deg, #44ff44, #66ff66);
}

.stat-value {
    min-width: 40px;
    text-align: right;
    font-weight: bold;
}

.resources {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(42, 42, 62, 0.8);
    padding: 10px;
    border-radius: 5px;
    min-width: 150px;
}

.resource-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.resource-item span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.resource-item canvas {
    vertical-align: middle;
}

.controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

button {
    padding: 10px 20px;
    background: #4a4a6e;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

button:hover {
    background: #5a5a7e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

.inventory-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2a2a3e;
    border: 3px solid #4a4a6e;
    border-radius: 10px;
    padding: 20px;
    min-width: 400px;
    max-width: 600px;
    display: none;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.inventory-panel.active {
    display: block;
}

.inventory-panel h3 {
    margin-bottom: 15px;
    text-align: center;
    color: #fff;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.inventory-slot {
    aspect-ratio: 1;
    background: #1a1a2e;
    border: 2px solid #4a4a6e;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 5px;
}

.inventory-slot:hover {
    border-color: #6a6a8e;
    transform: scale(1.05);
}

.inventory-slot.empty {
    opacity: 0.5;
}

.inventory-slot .item-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.inventory-slot .item-canvas-icon {
    margin-bottom: 2px;
}

.inventory-slot .item-count {
    font-size: 12px;
    color: #aaa;
}

.crafting-section {
    border-top: 2px solid #4a4a6e;
    padding-top: 15px;
}

.crafting-section h4 {
    margin-bottom: 10px;
}

.crafting-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.craft-item {
    background: #1a1a2e;
    border: 2px solid #4a4a6e;
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.craft-item:hover {
    border-color: #6a6a8e;
    background: #2a2a3e;
}

.craft-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.craft-item-name {
    font-weight: bold;
}

.craft-item-cost {
    font-size: 12px;
    color: #aaa;
}

.instructions {
    margin-top: 10px;
    padding: 10px;
    background: rgba(42, 42, 62, 0.8);
    border-radius: 5px;
    font-size: 12px;
    text-align: center;
}

.instructions p {
    margin: 5px 0;
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    pointer-events: none;
    z-index: 2000;
    display: none;
}

.tooltip.active {
    display: block;
}

.stats-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2a2a3e;
    border: 3px solid #4a4a6e;
    border-radius: 10px;
    padding: 20px;
    min-width: 350px;
    max-width: 500px;
    display: none;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.stats-panel.active {
    display: block;
}

.stats-panel h3 {
    margin-bottom: 15px;
    text-align: center;
    color: #fff;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #1a1a2e;
    border-radius: 5px;
    border: 1px solid #4a4a6e;
}

.stat-name {
    flex: 1;
    color: #fff;
    font-weight: bold;
}

.stat-value {
    min-width: 80px;
    text-align: right;
    color: #4CAF50;
    font-weight: bold;
}

.stat-bonus {
    min-width: 100px;
    text-align: right;
    color: #FFD700;
    font-size: 12px;
    font-style: italic;
}

.equipped-items {
    border-top: 2px solid #4a4a6e;
    padding-top: 15px;
}

.equipped-items h4 {
    margin-bottom: 10px;
    color: #fff;
}

.equipped-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #1a1a2e;
    border-radius: 5px;
    margin-bottom: 5px;
    border: 1px solid #4a4a6e;
}

.equipped-item-icon {
    font-size: 20px;
}

.equipped-item-name {
    flex: 1;
    color: #fff;
    font-weight: bold;
}

.equipped-item-effect {
    color: #4CAF50;
    font-size: 12px;
}

