body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    background-color: #222;
    color: #eee;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0.65);
    transform-origin: center;
}

.screen {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay h2 {
    color: #c00;
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.overlay button {
    background-color: #444;
    color: #eee;
    border: 2px solid #c00;
    padding: 0.8rem 1.5rem;
    margin: 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.overlay button:hover {
    background-color: #c00;
    color: #fff;
}

.hidden {
    display: none !important;
}

#gameScreen {
    background-color: #111;
    position: relative;
    padding: 1rem;
    height: 100%;
    /* #c22828 */
}


/* Main Menu */

#mainMenu {
    padding: 2rem;
    background-color: #333;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#mainMenu h1 {
    font-size: 3rem;
    color: #c00;
    text-shadow: 2px 2px 4px #000;
}

#mainMenu button {
    background-color: #444;
    color: #eee;
    border: 2px solid #c00;
    padding: 0.8rem 1.5rem;
    margin: 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

#mainMenu button:hover {
    background-color: #c00;
}

#mainMenu button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

#mainMenu button[disabled]:hover {
    background-color: #444;
    opacity: 0.5;
    cursor: not-allowed;
}


/* Pause/Game Over/Victory Menus */

#pause , #over , #victory {

        position: absolute;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background-color: rgba(0, 0, 0, 0.8);
        z-index: 200;
}

#pause h2 , #over h2 , #victory h2 {

        color: #c00;
        font-size: 2.5rem;
        margin-bottom: 2rem;
}

#pause button , #over button , #victory button {

        background-color: #444;
        color: #eee;
        border: 2px solid #c00;
        padding: 0.8rem 1.5rem;
        margin: 0.5rem;
        font-size: 1.2rem;
        cursor: pointer;
        border-radius: 5px;
        width: 200px;
}

#pause button:hover , #over button:hover , #victory button:hover {
        background-color: #c00;
}

#handedToggle {
    display: none;
}

/* Blur */

/* .blurred {
    filter: blur(2px);
    opacity: 0.7;
} */



/* HUD */

#hud {
    position: sticky;
    top: 1;
    display: flex;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

#hud div {
    margin: 0 0.5rem;
}

#pauseBtn {
    background-color: #444;
    color: #eee;
    border: 1px solid #c00;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    border-radius: 3px;
}

#pauseBtn:hover {
    background-color: rgb(167, 5, 5);
}


/* Views */

#visuals {
    display: flex;
    flex-direction: column;
}

#views {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    height: 300px;
    perspective: 1200px;
    transform-style: preserve-3d;
    position: relative;
    width: 100%;
}

.view {
    border: 2px solid #555;
    background-color: #111;
    position: absolute;
    overflow: hidden;
    transform-style: preserve-3d;
    height: 100%;
}

#fView {
    width: 60%;
    z-index: 10;
    transform: translateZ(0);
    left: 20%;
    border-left: none;
    border-right: none;
}

#lView {
    width: 20%;
    transform-origin: right center;
    transform: rotateY(60deg);
    left: 0;
    border-right: none;
}

#rView {
    width: 20%;
    transform-origin: left center;
    transform: rotateY(-60deg);
    right: 0;
    border-left: none;
}



/* Interface */

#interface {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 1rem;
    border-radius: 5px;
     /* rgba(200, 115, 115, 0.7); */

}

#messageLog {
    height: 100px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #111;
    border: 1px solid #333;
}


.combatBtn {
    background-color: #333;
    color: #eee;
    border: 1px solid #c00;
    padding: 0.5rem 1rem;
    margin: 0.3rem;
    cursor: pointer;
    border-radius: 3px;
}

.combatBtn:hover {
    background-color: rgb(167, 5, 5);
}


/* Movement Controls */

#move {
    margin-top: 1rem;
    position: relative;
    display: flex;
    justify-content: center;
    padding: 20px;
}

#dPad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
    background: rgba(50, 50, 50, 0.5);
    border-radius: 50%;
    padding: 30px;
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.padTop,
.padBtm {
    width: 100px;
}

.padMid {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.padRight,
.padLeft {
    width: 100px;
}

#dPad button {
    background-color: #333;
    color: #eee;
    border: 1px solid #0a0;
    padding: 0.5rem 1rem;
    margin: 0.3rem;
    cursor: pointer;
    padding: 0.8rem 0;
    margin: 0;
    font-size: 1rem;
}

#dPad button:hover {
    background-color: rgb(2, 127, 2);
}


/* Map */

#map {
    margin-top: 1rem;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

#map h3 {
    color: #0af;
}

#mini {
    display: inline-block;
    margin-top: 0.5rem;
}

.mapRow {
    display: flex;
}

.mapCell {
    width: 20px;
    height: 20px;
    border: 1px solid #333;
    box-sizing: border-box;
}

.mapCell.unknown {
    background-color: #000;
}

.mapCell.discovered {
    background-color: #222;
}

.mapCell.current {
    background-color: #0a0;
    position: relative;
}

.mapCell.wall {
    background-color: #c00;
}

.mapCell.exit {
    background-color: #00a;
}

.mapCell.treasure {
    background-color: orange;
}

.mapContainer {
    position: relative;
    display: inline-block;
    padding: 25px;
    margin: 10px auto;
}

.mapDir {
    display: inline-block;
}

.dirIndicator {
    position: absolute;
    font-weight: bold;
    color: #0af;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.5);
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.north {
    top: 0;
}

.south {
    bottom: 0;
}

.east {
    right: 0;
}

.west {
    left: 5px;
}

.playerDir{
    color: rgb(10, 61, 10);
}

/* 3D Elements */

.perspective {
    width: 100%;
    height: 100%;
    position: relative;
    perspective: 1000px;
}

.three-d-wall,
.three-d-corridor-forward,
.three-d-corridor-side,
.three-d-enemy-forward,
.three-d-enemy-side,
.three-d-item-forward,
.three-d-item-side,
.three-d-exit-forward,
.three-d-exit-side {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transform-style: preserve-3d;
    transition: all 0.3s;
}

.three-d-corridor-forward {
    transform: translateZ(50px);
    background: linear-gradient(to bottom, #111, #000);
}

.three-d-corridor-side {
    transform: rotateY(90deg) translateZ(100px);
    background: linear-gradient(to bottom, #111, #000);
}

.three-d-wall {
    transform: translateZ(0);
    background-color: #333;
}

.three-d-enemy-forward {
    transform: translateZ(80px) scale(1.2);
    background-size: contain;
    background-repeat: no-repeat;
}

.three-d-enemy-side {
    /* transform: rotateY(90deg) translateZ(120px) scale(0.8); */
    background-size: contain;
    background-repeat: no-repeat;
}

.three-d-item-forward,
.three-d-exit-forward {
    transform: translateZ(70px);
    background-size: contain;
    background-repeat: no-repeat;
}

.three-d-item-side,
.three-d-exit-side {
    /* transform: rotateY(90deg) translateZ(110px); */
    background-size: contain;
    background-repeat: no-repeat;
}

/* Glow */

.treasureGlow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(255,165,0,0.6) 0%, rgba(255,165,0,0) 70%);
    animation: pulse 2s infinite;
}

.treasureItem {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}


.three-d-treasure-forward {
    transform: translateZ(70px);
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 165, 0, 0.2);
}

.three-d-treasure-side {
    /* transform: rotateY(90deg) translateZ(110px); */
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 165, 0, 0.2); 
}


/* Different Screen Sizes*/


/* Tablets */

@media screen and (max-width: 1024px) {
    body {
        transform: scale(0.8);
    }
}

/* Portrait */
@media screen and (max-width: 768px) {
    body {
        transform: scale(1.0);
    }
    
    .screen {
        padding: 0.5rem;
    }
    
    #hud {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #hud div {
        margin: 0.2rem;
        font-size: 0.9rem;
    }
    
    #fView {
        width: 50%;
        left: 25%;
    }
    
    #lView,
    #rView {
        width: 25%;
    }
}



/* Mobile */

@media screen and (max-width: 480px) {
    body {
        transform: scale(1.2);
        align-items: flex-start;
        padding-top: 1rem;
    }
    
    .screen {
        padding: 0.25rem;
    }
    
    #mainMenu {
        padding: 1rem;
    }
    
    #mainMenu h1 {
        font-size: 2rem;
    }
    
    #views {
        height: 200px;
    }
    

    #fView {
        width: 45%;
        left: 27.5%;
    }
    
    #lView,
    #rView {
        width: 27.5%;
    }
    
    #messageLog {
        height: 80px;
        font-size: 0.9rem;
    }
    
    #dPad {
        width: 120px;
        height: 120px;
        padding: 20px;
    }
    
    .padTop,
    .padBtm,
    .padRight,
    .padLeft {
        width: 80px;
    }
    
    #dPad button {
        font-size: 0.8rem;
        padding: 0.6rem 0;
    }
    
    .mapCell {
        width: 15px;
        height: 15px;
    }
    
    .dirIndicator {
        width: 15px;
        height: 15px;
        font-size: 12px;
    }
    
    .overlay h2,
    #pause h2,
    #over h2,
    #victory h2 {
        font-size: 1.8rem;
    }
    
    .overlay button,
    #pause button,
    #over button,
    #victory button {
        font-size: 1rem;
        width: 150px;
    }
}

/*  ////////////////////////////////////////////////////////////*/

/* Samsung Galaxy A13 5G */

@media screen and (max-width: 500px) and (max-height: 915px) {
    body {
        transform: scale(1.1);
        align-items: flex-start;
        padding-top: 2.5rem;
        min-height: 100vh;
    }
    
    .screen {
        padding: 0.3rem;
        max-width: 100%;
    }
    
    #mainMenu {
        padding: 1.2rem;
        margin: 0.5rem;
         display: flex;
        flex-direction: column;
        margin-top: 20%;
    }
    
    #mainMenu h1 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }
    
    #mainMenu button {
        padding: 0.9rem 1.2rem;
        margin: 0.4rem;
        font-size: 1.1rem;
        min-width: 160px;
    }
    
    #gameScreen {
        padding: 0.8rem;
    }
    
    #views {
        height: 220px;
        margin-bottom: 0.8rem;
    }
    
    #fView {
        width: 42%;
        left: 29%;
    }
    
    #lView {
        width: 29%;
        transform: rotateY(40deg);
    }

    #rView {
        width: 29%;
        transform: rotateY(-40deg);
    }
    
    #hud {
        padding: 0.4rem 0.8rem;
        margin-bottom: 0.8rem;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
    }
    
    #hud div {
        margin: 0.1rem;
        font-size: 0.85rem;
    }
    
    #pauseBtn {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
        margin-right: 2%;
    }
    
    #interface {
        padding: 0.8rem;
    }
    
    #messageLog {
        height: 25px;
        font-size: 0.85rem;
        padding: 0.4rem;
    }
    
    .combatBtn {
        padding: 0.6rem 0.8rem;
        margin: 0.2rem;
        font-size: 0.9rem;
        min-width: 80px;
    }
    
    #move {
        padding: 1%;
        margin-top: 0.8rem;
        display: flex;
        flex-direction: row; 
        justify-content: flex-start;
        align-items: flex-start;
        gap: 20px;
        position: relative;
        margin-bottom: 0;
    }
    
    #dPad {
        width: 130px;
        height: 130px;
        padding: 22px;
        flex-shrink: 0;
    }
    
    .padTop,
    .padBtm,
    .padRight,
    .padLeft {
        width: 85px;
    }
    
    #dPad button {
        font-size: 0.85rem;
        padding: 0.7rem 0;
    }

    
    #map {
        padding: 0.4rem;
        margin-top: 0;
        width: auto;
        flex: 1;
        max-width: 200px;
        position: absolute;
        top: 43%;
        right: 5%;
    }
    
    #map h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .mapCell {
        width: 16px;
        height: 16px;
    }
    
    .dirIndicator {
        width: 16px;
        height: 16px;
        font-size: 13px;
    }
    
    .overlay h2,
    #pause h2,
    #over h2,
    #victory h2 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .overlay button,
    #pause button,
    #over button,
    #victory button {
        font-size: 1.05rem;
        width: 170px;
        padding: 0.9rem 1.2rem;
        margin: 0.4rem;
    }


/*left*/
#lView .three-d-wall-side {
    transform: rotateY(45deg) translateZ(0px) scale(1.5);
}

#lView .three-d-enemy-side {
    transform: rotateY(55deg) translateZ(0px) scale(1.5);
}

#lView .three-d-item-side,
#lView .three-d-exit-side {
    transform: rotateY(45deg) translateZ(0px) scale(1.5);
}

/*right*/
#rView .three-d-wall-side {
    transform: rotateY(-45deg) translateZ(0px) scale(1.5);
}

#rView .three-d-enemy-side {
    transform: rotateY(-55deg) translateZ(0px) scale(1.5);
}

#rView .three-d-item-side,
#rView .three-d-exit-side {
    transform: rotateY(-45deg) translateZ(0px) scale(1.5);
}


.three-d-treasure-side {
    transform: scale(1.5); 
}

#handedToggle {
    display: inline-block;
}

#pause #handedToggle {
    background-color: #2a4d3a;
    border: 2px solid #4a7c59;
    font-size: 1.05rem;
    width: 170px;
    padding: 0.9rem 1.2rem;
    margin: 0.4rem;
}

#pause #handedToggle:hover {
    background-color: #3a5d4a;
    border-color: #5a8c69;
}

#dPad.left-handed-mode {
    position: absolute;
    top: 56%;
    right: 1%;
}

#map.left-handed-mode {
    position: absolute;
    top: 43%;
    left: 5% !important;
}


}



/* Landscape */
@media screen and (max-width: 915px) and (max-height: 412px) and (orientation: landscape) {
    body {
        transform: scale(0.75);
        align-items: flex-start;
        padding-top: 0.3rem;
    }
    
    #views {
        height: 160px;
    }
    
    #fView {
        width: 45%;
        left: 27.5%;
    }
    
    #lView,
    #rView {
        width: 27.5%;
    }
    
    #messageLog {
        height: 50px;
    }
    
    #dPad {
        width: 110px;
        height: 110px;
        padding: 18px;
    }
    
    .padTop,
    .padBtm,
    .padRight,
    .padLeft {
        width: 75px;
    }
    
    #hud {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    
    #hud div {
        font-size: 0.8rem;
    }
}

/*  ////////////////////////////////////////////////////////////*/



/* Very Small Phones */

@media screen and (max-width: 320px) {
    body {
        transform: scale(1.4);
    }
    
    #mainMenu h1 {
        font-size: 1.5rem;
    }
    
    #views {
        height: 150px;
    }
    
    #fView {
        width: 40%;
        left: 30%;
    }
    
    #lView,
    #rView {
        width: 30%;
    }
    
    #dPad {
        width: 100px;
        height: 100px;
        padding: 15px;
    }
    
    .padTop,
    .padBtm,
    .padRight,
    .padLeft {
        width: 70px;
    }
}


/* Extra Large Screens */

@media screen and (min-width: 1800px) {
    body {
        transform: scale(0.5);
    }
}