/* Import Modern Font */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800;900&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0F172A;
    font-family: 'Outfit', sans-serif;
    color: #F8FAFC;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#game-canvas:active {
    cursor: grabbing;
}

/* Glassmorphism Common Panels */
.glass-panel {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border-radius: 24px;
}

.hidden {
    display: none !important;
}

/* HUD Overlay */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#hud * {
    pointer-events: auto;
}

.hud-top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-badge {
    padding: 10px 18px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-level-bar {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

#hud-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #6366F1, #EC4899);
    border-radius: 10px;
    transition: width 0.2s ease;
}

#hud-combo-banner {
    position: absolute;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FF4500, #FFD700);
    padding: 8px 24px;
    border-radius: 50px;
    font-weight: 900;
    font-size: 1.3rem;
    color: #000;
    box-shadow: 0 0 25px rgba(255, 69, 0, 0.8);
    animation: pulseCombo 0.4s infinite alternate ease-in-out;
}

@keyframes pulseCombo {
    from { transform: translateX(-50%) scale(1); }
    to { transform: translateX(-50%) scale(1.1); }
}

.hud-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #FFF;
    font-size: 1.3rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: transform 0.2s, background 0.2s;
}

.hud-icon-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.25);
}

.hud-icon-btn.muted {
    opacity: 0.5;
}

/* Fullscreen Screens / Modals */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

/* Main Menu with translucent background for live centered tower preview */
#main-menu {
    background: radial-gradient(circle at center, rgba(30, 27, 75, 0.6) 0%, rgba(15, 23, 42, 0.75) 100%);
}

.game-title {
    font-size: 4rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #38BDF8, #8B5CF6, #EC4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    text-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.game-subtitle {
    font-size: 1.1rem;
    color: #94A3B8;
    margin-bottom: 30px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 320px;
}

.btn-primary {
    padding: 16px 28px;
    border-radius: 50px;
    border: none;
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #FFF;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.7);
}

.btn-secondary {
    padding: 14px 24px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #FFF;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.menu-row-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    padding: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 800;
}

.close-modal-btn {
    background: none;
    border: none;
    color: #94A3B8;
    font-size: 1.8rem;
    cursor: pointer;
}

/* Shop UI */
.shop-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.shop-tab-btn {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #94A3B8;
    font-weight: 700;
    cursor: pointer;
}

.shop-tab-btn.active {
    background: #6366F1;
    color: #FFF;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    max-height: 450px;
    overflow-y: auto;
    padding-right: 6px;
}

.shop-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.shop-card.selected {
    border-color: #6366F1;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.skin-preview, .theme-preview {
    width: 46px;
    height: 46px;
    border-radius: 50%;
}

.shop-card-name {
    font-size: 0.9rem;
    font-weight: 700;
}

.shop-btn {
    width: 100%;
    padding: 8px;
    border-radius: 10px;
    border: none;
    background: #10B981;
    color: #FFF;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
}

.shop-btn.equipped {
    background: rgba(255, 255, 255, 0.2);
    color: #94A3B8;
}

/* Achievements & Daily Lists */
.achievement-item, .daily-item {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.achievement-item.unlocked {
    border-left: 4px solid #10B981;
}

.ach-icon {
    font-size: 1.8rem;
}

.ach-title, .daily-desc {
    font-weight: 700;
    font-size: 1rem;
}

.ach-desc, .daily-progress {
    font-size: 0.85rem;
    color: #94A3B8;
}

.daily-item {
    justify-content: space-between;
}

.daily-claim-btn {
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    background: #F59E0B;
    color: #000;
    font-weight: 800;
    cursor: pointer;
}

.daily-claim-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: #64748B;
    cursor: not-allowed;
}

/* End Game Summaries */
.stat-summary {
    display.grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    width: 100%;
    margin: 20px 0;
}

.stat-box {
    background: rgba(255, 255, 255, 0.06);
    padding: 14px;
    border-radius: 16px;
    text-align: center;
}

.stat-val {
    font-size: 1.6rem;
    font-weight: 900;
    color: #38BDF8;
}

.stat-lbl {
    font-size: 0.8rem;
    color: #94A3B8;
    text-transform: uppercase;
}
