/**
 * Survival Game Styles - Hero Defense System
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    overflow: hidden;
    padding: 15px;
}

/* ===== Layout ===== */

.game-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.canvas-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.panel-area {
    width: 280px;
    flex-shrink: 0;
}

/* ===== Title ===== */

.game-title {
    font-size: 36px;
    font-weight: bold;
    color: #ff8000;
    text-shadow: 0 0 20px rgba(255, 128, 0, 0.4);
    margin-bottom: 2px;
}

.game-subtitle {
    font-size: 14px;
    color: #6a6a8a;
    margin-bottom: 8px;
}

/* ===== Canvas ===== */

#gameCanvas {
    border: 2px solid #3a3a5a;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(60, 60, 100, 0.3);
    cursor: pointer;
    display: block;
}

/* ===== Buttons ===== */

.game-controls {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn {
    padding: 10px 24px;
    font-size: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(135deg, #ff8000, #cc4400);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 128, 0, 0.4);
}

.btn-secondary {
    background: #2a2a4a;
    color: #aaa;
}

.btn-secondary:hover {
    background: #3a3a6a;
}

/* ===== Inventory Panel ===== */

.inventory-panel {
    background: rgba(20, 20, 35, 0.95);
    border: 2px solid #3a3a5a;
    border-radius: 12px;
    padding: 15px;
    max-height: 640px;
    overflow-y: auto;
}

.inventory-panel::-webkit-scrollbar {
    width: 6px;
}

.inventory-panel::-webkit-scrollbar-track {
    background: #1a1a2a;
}

.inventory-panel::-webkit-scrollbar-thumb {
    background: #4a4a6a;
    border-radius: 3px;
}

.panel-placeholder {
    text-align: center;
    color: #555;
    padding: 60px 20px;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.panel-section {
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid #2a2a3a;
}

.panel-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.panel-title {
    font-size: 14px;
    font-weight: bold;
    color: #aaa;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gold-display {
    color: #ffd700;
    font-size: 13px;
}

/* ===== Stats Grid ===== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.stat-item {
    background: #1a1a2a;
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
    border: 1px solid #2a2a3a;
}

.stat-value {
    font-size: 16px;
    font-weight: bold;
    color: #4fc3f7;
}

.stat-label {
    font-size: 9px;
    color: #666;
    margin-top: 2px;
}

/* ===== Equipment Slots ===== */

.equip-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.equip-slot {
    background: #1a1a2a;
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    border: 2px solid #2a2a3a;
    transition: all 0.2s;
}

.equip-slot.empty {
    opacity: 0.5;
}

.equip-slot.equipped {
    background: #1e1e35;
}

.equip-slot:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.slot-emoji {
    font-size: 28px;
    margin-bottom: 4px;
}

.slot-name {
    font-size: 10px;
    color: #666;
}

.item-name {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-stats {
    font-size: 9px;
    color: #888;
}

.sell-price {
    font-size: 9px;
    color: #ffd700;
    margin-top: 3px;
}

/* ===== Inventory Grid ===== */

.inventory-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.empty-inventory {
    text-align: center;
    color: #444;
    font-size: 12px;
    padding: 20px;
}

.inv-item {
    background: #1a1a2a;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #2a2a3a;
    transition: all 0.2s;
}

.inv-item:hover {
    background: #1e1e30;
    transform: translateX(2px);
}

.item-emoji {
    font-size: 22px;
    flex-shrink: 0;
}

.inv-item .item-name {
    font-size: 11px;
    flex: 1;
    min-width: 0;
}

.inv-item .item-stats {
    font-size: 9px;
    flex-shrink: 0;
}

.item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-equip, .btn-sell {
    padding: 4px 8px;
    font-size: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.btn-equip {
    background: #2a4a6a;
    color: #4fc3f7;
}

.btn-equip:hover {
    background: #3a5a7a;
}

.btn-sell {
    background: #4a3a1a;
    color: #ffa500;
}

.btn-sell:hover {
    background: #5a4a2a;
}

/* ===== Bottom Features ===== */

.game-features {
    display: flex;
    gap: 40px;
    margin-top: 15px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
}

.feature-icon {
    font-size: 20px;
}

.feature-text {
    font-size: 14px;
}

/* ===== Responsive ===== */

@media (max-width: 1100px) {
    .game-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .panel-area {
        width: 100%;
        max-width: 800px;
    }

    .equip-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 850px) {
    #gameCanvas {
        max-width: 100%;
    }
}
