:root {
    --bg-color: #050510;
    --text-color: #bdbdbd;
    --highlight: #00ffcc;
    --danger: #ff5555;
    --font-main: "Courier New", monospace;
    --font-bold: "Courier New", monospace;
}

body {
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    color: var(--text-color);
    overflow: hidden;
    /* Prevent scrolling */
    user-select: none;
}

/* Back Button */
.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    text-decoration: none;
    z-index: 1000;
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.back-btn svg {
    width: 24px;
    height: 24px;
}

/* Mute Button */
.mute-btn {
    position: fixed;
    top: 20px;
    left: 70px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s;
    padding: 0;
}

.mute-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.mute-btn svg {
    width: 24px;
    height: 24px;
}

/* Scream Mute Button (Ghost) */
.mute-scream-btn {
    position: fixed;
    top: 20px;
    left: 120px;
    width: 40px;
    height: 40px;
    background: rgba(255, 85, 85, 0.1);
    /* Red tint */
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 85, 85, 0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--danger);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.5s ease-in-out;
    padding: 0;
    opacity: 1;
}

.mute-scream-btn:hover {
    background: rgba(255, 85, 85, 0.2);
    transform: scale(1.1);
}

.mute-scream-btn svg {
    width: 20px;
    height: 20px;
}

/* Color Selector Button */
.color-select-btn {
    position: fixed;
    top: 20px;
    left: 170px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: var(--font-bold);
    font-size: 14px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s;
    padding: 0 15px;
    appearance: none;
    outline: none;
}

.color-select-btn option {
    background: #111;
    color: white;
}

.color-select-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.fade-in-btn {
    animation: fadeInBtn 1.5s forwards;
}

@keyframes fadeInBtn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Game Container */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* HUD */
#tower-stats-bar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 20px;
    font-size: 18px;
    font-weight: bold;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

/* Canvas */
#tower-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

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

/* Overlays (Start & Game Over) */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    backdrop-filter: blur(8px);
}

.start-title {
    font-size: 64px;
    color: var(--highlight);
    margin: 0;
    text-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
    letter-spacing: 5px;
}

.game-over-title {
    font-size: 64px;
    color: var(--danger);
    margin: 0;
    text-shadow: 0 0 20px rgba(255, 85, 85, 0.5);
    letter-spacing: 5px;
}

.start-info {
    font-size: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 25px;
    max-width: 500px;
    line-height: 1.6;
}

.start-info p {
    margin: 10px 0;
}

.start-info strong {
    color: white;
}

h2#tower-final-score {
    color: white;
    font-size: 32px;
    margin: 0;
}

/* Buttons */
.btn {
    font-family: var(--font-bold);
    font-weight: bold;
    font-size: 20px;
    padding: 15px 40px;
    background: transparent;
    color: var(--highlight);
    border: 2px solid var(--highlight);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.btn:hover {
    background: rgba(0, 255, 204, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.3);
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.95);
}

#btn-restart-tower {
    color: white;
    border-color: white;
}

#btn-restart-tower:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    .start-title {
        font-size: 40px;
    }

    .game-over-title {
        font-size: 40px;
    }

    #tower-stats-bar {
        font-size: 14px;
        top: 15px;
        right: 15px;
        flex-direction: column;
        gap: 5px;
        padding: 8px 15px;
    }

    .start-info {
        font-size: 14px;
        padding: 15px;
        width: 85%;
    }

    .back-btn {
        top: 15px;
        left: 15px;
        width: 35px;
        height: 35px;
    }

    .mute-btn {
        top: 15px;
        left: 60px;
        width: 35px;
        height: 35px;
    }

    .mute-scream-btn {
        top: 15px;
        left: 105px;
        width: 35px;
        height: 35px;
    }

    .color-select-btn {
        top: 15px;
        left: 150px;
        height: 35px;
        padding: 0 10px;
        font-size: 12px;
    }
}

/* Highscore HUD */
#tower-highscore-hud {
    position: absolute;
    top: 70px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 153, 0, 0.3);
    backdrop-filter: blur(4px);
    color: #ff9900;
}

#tower-highscore-name {
    color: white;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Name Entry Input */
#tower-highscore-name-input {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #ff9900;
    border-radius: 8px;
    color: white;
    font-family: var(--font-bold);
    font-size: 24px;
    padding: 15px;
    width: 250px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    letter-spacing: 2px;
    transition: all 0.2s;
}

#tower-highscore-name-input:focus {
    box-shadow: 0 0 15px rgba(255, 153, 0, 0.5);
}

#tower-highscore-name-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 16px;
}

@media (max-width: 768px) {
    #tower-highscore-hud {
        top: 60px;
        /* Below the buttons array on mobile */
        left: 15px;
        padding: 8px 12px;
        font-size: 12px;
    }

    #tower-highscore-name {
        font-size: 14px;
    }
}