* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: #eaddd3;
    background-image: radial-gradient(#d3c6bc 1.5px, transparent 1.5px);
    background-size: 20px 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    touch-action: none; /* Prevent mobile scrolling, bouncing, zooming */
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1000px;
    max-height: 800px;
    background-color: #fdfaf6;
    background-image: 
        linear-gradient(0deg, transparent 24%, rgba(220, 210, 200, 0.4) 25%, rgba(220, 210, 200, 0.4) 26%, transparent 27%, transparent 74%, rgba(220, 210, 200, 0.4) 75%, rgba(220, 210, 200, 0.4) 76%, transparent 77%, transparent), 
        linear-gradient(90deg, transparent 24%, rgba(220, 210, 200, 0.4) 25%, rgba(220, 210, 200, 0.4) 26%, transparent 27%, transparent 74%, rgba(220, 210, 200, 0.4) 75%, rgba(220, 210, 200, 0.4) 76%, transparent 77%, transparent);
    background-size: 40px 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 4px solid #c8b9a9;
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 800px) {
    #game-container {
        border: none;
        border-radius: 0;
        max-width: 100%;
        max-height: 100%;
    }
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none;
}

#score-display, #high-score-display {
    font-size: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    color: #5c4e46;
    background: rgba(253, 250, 246, 0.9);
    padding: 6px 14px;
    border-radius: 20px;
    border: 2px dashed #b5a496;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

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

#game-over-screen, #start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(253, 250, 246, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    text-align: center;
    color: #333;
    transition: opacity 0.3s ease;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    border: 2px dashed #d1c4b7;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    max-width: 90%;
}

h1 {
    font-size: 2.5rem;
    color: #e06c75;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

p {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 10px;
}

.btn {
    margin-top: 20px;
    padding: 12px 30px;
    font-size: 1.2rem;
    background-color: #e06c75;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 10px rgba(224, 108, 117, 0.4);
}

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

.btn:hover {
    background-color: #d15d66;
}

.subtext {
    font-size: 0.85rem;
    margin-top: 15px;
    color: #999;
}

@media (max-width: 400px) {
    #score-display, #high-score-display {
        font-size: 0.85rem;
        padding: 4px 10px;
    }
    h1 {
        font-size: 1.8rem;
    }
    p {
        font-size: 0.95rem;
    }
    .modal-content {
        padding: 20px 20px;
    }
}
