@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap');

body {
    margin: 0;
    overflow: hidden;
    background-color: #2c3e50;
    font-family: 'Fredoka One', cursive;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none; /* Prevents browser zooming/scrolling */
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

canvas {
    background-color: #88bdbc;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border-radius: 8px;
}

/* UI Overlays */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    pointer-events: auto;
    z-index: 10;
}

.hidden {
    display: none !important;
}

h1 { font-size: 60px; margin-bottom: 10px; color: #f1c40f; text-shadow: 3px 3px 0 #e67e22; text-align: center; }
p { font-size: 24px; max-width: 600px; text-align: center; line-height: 1.5; padding: 0 20px; }

.btn {
    padding: 15px 40px;
    font-size: 24px;
    margin: 10px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Fredoka One', cursive;
    transition: transform 0.1s, filter 0.1s;
    box-shadow: 0 5px 0 rgba(0,0,0,0.2);
}

.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.2); }
.btn:hover { filter: brightness(1.1); }

.btn-cat { background-color: #e67e22; color: white; }
.btn-dog { background-color: #3498db; color: white; }
.btn-start { background-color: #2ecc71; color: white; margin-top: 30px; }
.btn-quit { background-color: #c0392b; color: white; margin-top: 20px; font-size: 18px; padding: 10px 30px; }

.btn-hud-quit { background-color: #c0392b; color: white; font-size: 16px; padding: 8px 20px; border-radius: 20px; pointer-events: auto; border: 2px solid #e74c3c; cursor: pointer;}
.btn-hud-quit:hover { background-color: #e74c3c; }

.btn-hud-music { background-color: #f39c12; color: white; font-size: 16px; padding: 8px 20px; border-radius: 20px; pointer-events: auto; border: 2px solid #e67e22; cursor: pointer; margin-right: 10px; }
.btn-hud-music:hover { background-color: #e67e22; }

.btn-hud-help { background-color: #9b59b6; color: white; font-size: 16px; padding: 8px 20px; border-radius: 20px; pointer-events: auto; border: 2px solid #8e44ad; cursor: pointer; margin-right: 10px; }
.btn-hud-help:hover { background-color: #8e44ad; }

/* HUD */
#hud {
    pointer-events: none;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.stats-box {
    background: rgba(0,0,0,0.6);
    padding: 10px 20px;
    border-radius: 15px;
    color: white;
    font-size: 20px;
    display: flex;
    gap: 20px;
    pointer-events: auto;
    align-items: center;
}

#next-wave-container {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
    z-index: 5;
}

.btn-wave {
    background-color: #f39c12;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(243, 156, 18, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(243, 156, 18, 0); }
}

/* Shop */
#shop {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    padding: 10px;
    border-radius: 20px;
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.shop-item {
    width: 70px;
    height: 90px;
    background: #ecf0f1;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 3px solid transparent;
    position: relative;
}

.shop-item:hover { transform: translateY(-5px); }
.shop-item.selected { border-color: #f1c40f; background: #fff; }
.shop-item.disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }

.shop-icon { width: 40px; height: 40px; margin-bottom: 5px; }
.shop-cost { font-size: 14px; color: #2c3e50; }
.shop-name { font-size: 10px; color: #7f8c8d; text-transform: uppercase; }
.hotkey { position: absolute; top: 2px; right: 5px; font-size: 10px; color: #95a5a6; }

.nuke-btn {
    background: #c0392b;
    color: white;
    border: 2px solid #e74c3c;
}
.nuke-btn.cooldown {
    background: #555;
    border-color: #333;
}

/* Notifications */
#wave-notification {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: white;
    text-shadow: 2px 2px 0 #000;
    opacity: 0;
    transition: opacity 0.5s;
}

/* Help Content */
.help-content {
    text-align: left;
    max-width: 700px;
    padding: 30px;
    background: rgba(44, 62, 80, 0.95);
    border: 4px solid #f1c40f;
    border-radius: 15px;
    overflow-y: auto;
    max-height: 80vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}
.help-content h2 { color: #f1c40f; border-bottom: 2px solid #fff; padding-bottom: 5px; margin-top: 20px; }
.help-content li { margin-bottom: 12px; font-size: 18px; }
.help-icon { display: inline-block; width: 30px; text-align: center; }

/* Custom Modal */
#modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex; justify-content: center; align-items: center;
    z-index: 100;
    pointer-events: auto;
}
.modal-box {
    background: #34495e;
    padding: 30px 50px;
    border-radius: 15px;
    text-align: center;
    border: 4px solid #f1c40f;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}
.modal-text { font-size: 28px; margin-bottom: 30px; }
.modal-btn {
    padding: 10px 30px; font-size: 20px; margin: 0 10px; border: none; border-radius: 25px; cursor: pointer;
    font-family: 'Fredoka One', cursive; transition: transform 0.1s;
}
.modal-btn:hover { transform: scale(1.05); }
.modal-yes { background-color: #2ecc71; color: white; }
.modal-no { background-color: #e74c3c; color: white; }

/* Mobile Adjustments */
@media (max-width: 768px) {
    h1 { font-size: 40px; }
    .stats-box { padding: 5px 10px; font-size: 14px; gap: 10px; }
    .btn { padding: 10px 20px; font-size: 18px; }
    .btn-hud-music, .btn-hud-help, .btn-hud-quit { padding: 5px 10px; font-size: 12px; margin-right: 5px; }
    .shop-item { width: 50px; height: 70px; margin: 2px; }
    .shop-icon { width: 25px; height: 25px; font-size: 20px !important; }
    .shop-name { font-size: 8px; }
    .shop-cost { font-size: 10px; }
    #shop { bottom: 10px; gap: 5px; }
    #next-wave-container { bottom: 140px; }
    .modal-text { font-size: 20px; }
    .modal-btn { font-size: 16px; padding: 8px 20px; }
}