:root {
    --frame-thickness: 16px;
    --hud-height: 20px;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2e2e2e;
    font-family: sans-serif;
}

#wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#frame {
    position: relative;

    background: #3b3b3b;
    border: 6px solid #1f1f1f;
    border-radius: 12px;
    box-shadow: 0 0 0 4px #555, 0 16px 40px rgba(0, 0, 0, 0.6);
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    background-image: url("./images/level-1-wot-map-final.png");
    /* GPU acceleration */
    /* will-change: transform;
    transform: translateZ(0); */
}

#background {
    position: absolute;
    inset: 0;
    background-image: url("./images/level-1-wot-map-final.png");
    background-size: cover;
    background-position: center;
    z-index: 0;
}

#map-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    pointer-events: auto;
    overflow: visible;
}

#map {
    display: block;
    transform-origin: bottom left;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* to remove the cursor from the game */
body,
#game {
    position: relative;
    overflow: visible;
    image-rendering: pixelated;
    user-select: none;
    caret-color: transparent;
    overflow: visible;
    /*will-change: contents; Helps browser optimize */
}

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    padding: 00 20px;
    z-index: 3;
    pointer-events: none;

}

.hud-item {
    margin: 10;
    align-items: center;
    font-family: monospace;
    font-size:1rem;
    font-weight: 700;
    color: #fff;
    text-shadow:
        -1px -1px 0 black,
        /* Top-left shadow */
        1px -1px 0 black,
        /* Top-right shadow */
        -1px 1px 0 black,
        /* Bottom-left shadow */
        1px 1px 0 black;
    /* Bottom-right shadow */
}

/* Game area */
#game {
    position: relative;
    overflow: hidden;
    image-rendering: pixelated;
    transform-origin: top left;
}

#game * {
    image-rendering: pixelated;
}


/* Menu overlay */
#menu {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.Menubtn {
    font-family: monospace;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 5px;

    /* remove smoothing = more pixel look */
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    font-smooth: never;

    color: #ffd37b;
    /* center fill */

    /* PIXEL OUTLINES (first yellow, then dark) */
    text-shadow:
        /* light outline (orange/yellow) */
        -2px -2px 0 #db8b2b,
        2px -2px 0 #db8b2b,
        -2px 2px 0 #db8b2b,
        2px 2px 0 #db8b2b,

        /* darker outer outline */
        -4px -4px 0 #3a2847,
        4px -4px 0 #3a2847,
        -4px 4px 0 #3a2847,
        4px 4px 0 #3a2847;
    padding: 10px 10px;
    border: none;
    color: yellow;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    text-align: center;
    user-select: none;
    background-color: transparent;
}

.sound-toggle {
    font-size: 20px;
    letter-spacing: 2px;
    padding: 6px 14px;
}

#popup .Menubtn,
h2,
p {
    width: 100%;
    padding: 5px 1px;
    font-size: 30px;
    user-select: none;
}

/* Full-screen popup overlay */
.popup {
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at top,
        rgba(0, 0, 0, 0.4),
        rgba(0, 0, 0, 0.85)
    );
}

/* Popup box */
.popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;

    background: linear-gradient(145deg, #f5e3b5, #d2b88a);
    border-radius: 18px;
    padding: 32px 56px;
    gap: 7px;

    width: 32%;
    max-width: 480px;
    height: auto;

    border: 2px solid rgba(90, 70, 40, 0.9);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.7),
                0 0 0 2px rgba(250, 240, 210, 0.3);
}

.popup-content h1,
.popup-content h2 {
    color: #2b1c10;
    margin: 0;
    padding: 0;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.4);
}

.popup-content p {
    color: #3b2a18;
    margin: 0;
}

/* Buttons */
.popup-content button {
    background: linear-gradient(145deg, #7c3b11, #c46a23);
    color: #fdf4d0;
    border: 2px solid #f1cf7e;
    padding: 8px 22px;
    border-radius: 10px;
    font-weight: bold;
    letter-spacing: 0.08em;
    /* text-transform: uppercase; */
    cursor: pointer;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.7);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.6);
    /* transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease; */
}

.popup-content button:hover {
    /*transform: translateY(-1px);*/
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.7);
    filter: brightness(1.05);
}

.popup-content button:active {
    /* transform: translateY(1px); */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
}

.popup-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}
.player {
    position: absolute;
    left: 0;
    bottom: 0;
    /* transform will handle positioning */
    will-change: transform;
    transform-origin: bottom center;
}

.hidden {
    display: none !important;
}

#menu img {
  display: block;
  margin: 0;
  max-width: 400px;
  height: 250px;
}
/* ======================================= */
/* 📱 RESPONSIVE — Mobile Phones */
/* ======================================= */
@media (max-width: 768px) {
    #popup .Menubtn,
    h2,
    p {
        font-size: 22px;
    }

    .popup-content {
        width: 85%;
        padding: 22px 24px;
        gap: 10px;
    }

    .popup-content button {
        padding: 10px 18px;
        font-size: 16px;
    }
}

/* ======================================= */
/* 📱 Very Small Screens */
@media (max-width: 480px) {
    #popup .Menubtn,
    h2,
    p {
        font-size: 18px;
    }

    .popup-content {
        width: 92%;
        padding: 18px;
    }

    .popup-content button {
        padding: 10px 14px;
        font-size: 14px;
    }
}
