/* ===== Tower Defense — Game Screen (Landscape Layout) ===== */
/* Matches reference image 2: top HUD pills, left canvas, right shop panel, bottom action bar */

#gameScreen {
    background: linear-gradient(135deg, #1a1a3e 0%, #2d1b69 100%);
}
#gameScreen.active {
    display: flex;
    flex-direction: column;
}

/* ===== Top HUD Bar (rounded pill badges) ===== */
.game-top-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 16px;
    z-index: 100;
    flex-shrink: 0;
}

.hud-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(30, 20, 60, 0.85);
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 14px;
    backdrop-filter: blur(4px);
}

.hud-emoji {
    font-size: 16px;
}

.hud-val {
    font-weight: bold;
    font-size: 15px;
}
.hud-val.gold { color: #FFD700; }
.hud-val.lives { color: #FF6B6B; }
.hud-val.wave { color: #87CEEB; }
.hud-val.score { color: #FFEAA7; }

.level-name-pill {
    border-color: rgba(255,255,255,0.1);
    background: rgba(30, 20, 60, 0.6);
}
.level-name-pill .hud-val {
    color: rgba(255,255,255,0.7);
    font-weight: normal;
    font-size: 13px;
}

/* ===== Main Game Area (canvas + shop side by side) ===== */
.game-main-area {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
    gap: 0;
    padding: 2px 0 2px 4px;
    overflow: hidden;
}

.canvas-wrapper {
    /* JS will set explicit width/height via _resizeCanvas() */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

#gameCanvas {
    display: block;
    border-radius: 8px;
    touch-action: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    /* Width/height are set dynamically by JS _resizeCanvas() */
}

/* ===== Right Shop Panel ===== */
.shop-panel {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    background: rgba(30, 20, 60, 0.85);
    border-radius: 14px 0 0 14px;
    border: 1.5px solid rgba(255,255,255,0.12);
    border-right: none;
    backdrop-filter: blur(6px);
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 50;
}

.shop-title {
    font-size: 12px;
    font-weight: bold;
    color: rgba(255,255,255,0.8);
    letter-spacing: 1px;
    padding: 4px 0 2px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    text-align: center;
}

.shop-tower {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 6px 4px 5px;
    width: 68px;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-tower:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.shop-tower:active {
    transform: scale(0.97);
}

.shop-tower.selected {
    background: rgba(78, 205, 196, 0.2);
    border-color: #4ECDC4;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.shop-tower.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.shop-tower.disabled:hover {
    transform: none;
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.15);
}

.shop-tower-icon {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 2px;
}

.shop-tower-name {
    font-size: 10px;
    font-weight: bold;
    color: rgba(255,255,255,0.85);
    margin-bottom: 1px;
}

.shop-tower-cost {
    font-size: 9px;
    color: #FFD700;
    font-weight: bold;
}

/* ===== Bottom Action Bar ===== */
.game-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    z-index: 100;
    flex-shrink: 0;
}

.bottom-hint {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
}

.btn-action {
    border: none;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-wave-action {
    background: linear-gradient(135deg, #4ECDC4, #44B39D);
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 13px;
    box-shadow: 0 3px 12px rgba(78,205,196,0.4);
}
.btn-wave-action:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(78,205,196,0.5);
}
.btn-wave-action:active { transform: scale(0.97); }

.btn-circle-action {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1.5px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.btn-circle-action:hover {
    background: rgba(255,255,255,0.25);
}
.btn-quit {
    color: #FF6B6B;
    border-color: rgba(255,107,107,0.4);
}
.btn-quit:hover {
    background: rgba(255,107,107,0.2);
}

/* ===== Tower Info Panel ===== */
.tower-info {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 10, 50, 0.95);
    border: 2px solid rgba(167, 139, 250, 0.5);
    border-radius: 14px;
    padding: 12px 16px;
    min-width: 240px;
    z-index: 150;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.tower-info-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

#towerInfoIcon { font-size: 24px; }
#towerInfoName { font-size: 14px; font-weight: bold; color: #fff; flex: 1; }
#towerInfoLevel {
    font-size: 11px;
    color: #FFD700;
    background: rgba(255, 215, 0, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
}

.tower-info-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}
.tower-info-stats span { color: #4ECDC4; font-weight: bold; }

.tower-info-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-upgrade {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.15s;
    flex: 1;
}
.btn-upgrade:hover { transform: scale(1.03); }
.btn-upgrade:active { transform: scale(0.97); }
.btn-upgrade:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-sell {
    background: rgba(255,107,107,0.2);
    color: #FF6B6B;
    border: 1px solid rgba(255,107,107,0.4);
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}
.btn-sell:hover { background: rgba(255,107,107,0.3); transform: scale(1.03); }
.btn-sell:active { transform: scale(0.97); }

/* ===== Responsive ===== */
@media (max-height: 400px) {
    .game-top-hud { padding: 4px 12px; gap: 6px; }
    .hud-pill { padding: 3px 10px; font-size: 12px; }
    .game-bottom-bar { padding: 4px 12px; gap: 8px; }
    .shop-panel { width: 64px; }
    .shop-tower { width: 56px; padding: 4px 2px 3px; }
    .shop-tower-icon { font-size: 20px; }
    .shop-tower-name { font-size: 9px; }
}
