* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1a1a1a;
    background-image: radial-gradient(#4CAF50 4px, transparent 0),
                      radial-gradient(#FFEB3B 4px, transparent 0);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    color: #eee;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.hidden {
    display: none;
}

canvas {
    background-color: #000;
    border: 2px solid #444;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 1 / 1;
    touch-action: none; /* Prevents browser handling of touch events like scrolling */
}

#ui {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: white;
    text-shadow: 2px 2px 4px #000;
    white-space: nowrap;
    z-index: 5;
}

#start-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    padding: clamp(1.5rem, 6vw, 2.5rem) clamp(2rem, 10vw, 4rem);
    border-radius: 10px;
    text-align: center;
    border: 2px solid #444;
    color: white;
    width: 80%;
    max-width: 400px;
    z-index: 10;
}

#start-screen h1 {
    margin: 0 0 20px;
    color: #4CAF50;
    font-size: clamp(2rem, 8vw, 3rem);
    text-shadow: 3px 3px 0px #000;
}

#start-button {
    padding: 15px 30px;
    font-size: clamp(1.2rem, 5vw, 1.5rem);
    background-color: #ff4757;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    transition: background-color 0.2s;
    text-shadow: 2px 2px 2px #000;
}

#start-button:active {
    background-color: #e8414f;
}

#game-over-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    padding: clamp(1rem, 5vw, 2rem) clamp(1.5rem, 8vw, 3rem);
    border-radius: 10px;
    text-align: center;
    border: 2px solid #444;
    color: white;
    width: 80%;
    max-width: 400px;
    z-index: 10;
}

#game-over-screen.hidden {
    display: none;
}

#game-over-screen h1 {
    margin: 0 0 10px;
    color: #ff4757;
    font-size: clamp(1.8rem, 6vw, 2.5rem);
}

#game-over-screen p {
    margin: 0 0 20px;
    font-size: clamp(1rem, 4vw, 1.5rem);
}

#restart-button {
    padding: 12px 24px;
    font-size: clamp(1rem, 4vw, 1.2rem);
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    transition: background-color 0.2s;
}

#restart-button:active {
    background-color: #45a049;
}

#achievement-notification {
    position: absolute;
    bottom: 30px;
    left: 50%;
    width: 90%;
    max-width: 350px;
    background-color: #ffeb3b;
    color: #1a1a1a;
    padding: 15px;
    border-radius: 10px;
    z-index: 20;
    text-align: center;
    border: 3px solid #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: opacity 0.5s, transform 0.5s ease-out;
    opacity: 1;
    transform: translate(-50%, 0);
    font-size: 1rem;
}

#achievement-notification.hidden {
    opacity: 0;
    transform: translate(-50%, 150%); /* Move it down out of view */
    pointer-events: none;
}

#achievement-notification h3 {
    margin: 0 0 5px;
    font-size: clamp(1rem, 4vw, 1.2rem);
    color: #ff4757;
    text-shadow: 1px 1px 1px #0002;
}

#achievement-notification p {
    margin: 0;
    font-size: clamp(0.8rem, 3vw, 1rem);
    color: #333;
}