@font-face {
    font-family: 'zabars';
    src: url('./fonts/zabars.ttf') format(truetype);
}

@font-face {
    font-family: 'lato';
    src: url('./fonts/latoRegular.ttf') format(truetype);
}

:root {
    --low-height-threshold: 420px;
}

.onlyDesktop {
    display: inherit;
}

.onlyMobile {
    display: none;
}

body {
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    background-image: url('./img/background.jpg');
    background-repeat: no-repeat;
    background-position: center;
    font-family: 'zabars', Arial, Helvetica, sans-serif;
    background-size: 100% 100%;
    height: 100vh;
    overflow: hidden;
}

h1 {
    font-size: 64px;
    letter-spacing: 3px;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.5);
}

canvas {
    background-color: black;
    display: block;
}

.gameButton {
    width: 48px;
    aspect-ratio: 1;
    border-radius: 50%;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
}

.gameButton:hover {
    transform: scale(1.12);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
    border-color: white;
}

.gameButton:active {
    transform: scale(0.95);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}


#btnStart {
    background-image: url('./img/button/play-button.png');
}

#btnSound {
    background-image: url('./img/button/sound-button.png');
}

#btnFullscreen {
    background-image: url('./img/button/fullscreen.png');
}

#btnLeft {
    background-image: url('./img/button/arrow-left.png');
}

#btnRight {
    background-image: url('./img/button/arrow-right.png');
}

#btnThrow {
    background-image: url('./img/button/throw-button.png');
}

#btnOptions {
    background-image: url('./img/button/options.png');
}

#btnFight {
    background-image: url('./img/button/fight.png');
}

#btnJump {
    background-image: url('./img/button/jump.png');
}

#header {
    display: flex;
    justify-content: space-between;
}


#game-container {
    position: relative;
    width: 720px;
    height: 600px;
    display: flex;
    flex-direction: column;
}

#mobile-controls {
    gap: 20px;
    justify-content: space-between;
    width: 100%;
    display: flex;
    pointer-events: none;
}

#mobile-controls button {
    pointer-events: auto;
}

/* ################# FULLSCREEN Modus: ############################# */
html:fullscreen,
body:fullscreen,
html:-webkit-full-screen,
body:-webkit-full-screen {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

#game-container:fullscreen,
#game-container:-webkit-full-screen {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    position: relative;
}

#game-container:fullscreen #header,
#game-container:-webkit-full-screen #header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: 100%;
}

#game-container:fullscreen canvas,
#game-container:-webkit-full-screen canvas {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    position: relative;
}

#game-container:fullscreen #mobile-controls,
#game-container:-webkit-full-screen #mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

#game-container:fullscreen .onlyDesktop,
#game-container:-webkit-full-screen .onlyDesktop {
    display: none !important;
}

/* ####################### dialog ########################## */
footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

footer button {
    font-family: 'zabars', serif;
    font-size: 28px;
    letter-spacing: 2px;

    padding: 10px 24px;
    border: none;
    border-radius: 12px;

    background: linear-gradient(180deg, #d7c49e 0%, #b89a6a 100%);
    color: #3b2a14;

    box-shadow:
        0 0 10px rgba(0, 0, 0, 0.4),
        inset 0 0 6px rgba(0, 0, 0, 0.3);

    cursor: pointer;
    transition: 0.2s ease;
}

footer button:hover {
    background: linear-gradient(180deg, #f0d9a5 0%, #c7a873 100%);
    box-shadow:
        0 0 14px rgba(255, 215, 120, 0.7),
        inset 0 0 8px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

footer button:active {
    transform: translateY(1px);
    box-shadow:
        0 0 6px rgba(0, 0, 0, 0.5),
        inset 0 0 10px rgba(0, 0, 0, 0.5);
}

dialog.dialogClass {
    width: 80%;
    height: 80%;
    padding: 0;
    border-radius: 18px;

    background: linear-gradient(180deg, #fdf7e3 0%, #f3e4c3 100%);
    border: 4px solid rgba(120, 80, 40, 0.55);

    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.5),
        inset 0 0 12px rgba(0, 0, 0, 0.15),
        inset 0 0 40px rgba(255, 220, 150, 0.25);

    font-family: 'lato', Arial, Helvetica, sans-serif;
    max-width: 920px;
    overflow: hidden;
}

dialog.dialogClass[open] {
    display: flex;
    flex-direction: column;
    animation: dialogPop 0.35s ease-out;
}

dialog.dialogClass header {
    background: linear-gradient(180deg, #3b2a14 0%, #2a1d0f 100%);
    color: #f7d58c;

    text-shadow:
        2px 2px 0 #000,
        0 0 8px rgba(255, 200, 120, 0.6);

    padding: 18px 24px;
    border-bottom: 3px solid rgba(255, 220, 150, 0.3);

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btnDialogClose {
    background: transparent;
    border: none;
    color: #f7d58c;
    transition: 0.2s ease;
    cursor: pointer;
    padding: 4px 8px;
}

.btnDialogClose:hover {
    color: #ffb36b;
    text-shadow: 0 0 8px rgba(255, 180, 80, 0.8);
}

dialog.dialogClass main {
    display: flex;
    flex-direction: column;
    padding: 20px 28px;
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: rgba(255, 245, 220, 0.6);
    backdrop-filter: blur(2px);
    color: #3b2a14;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

dialog.dialogClass header h1 {
    font-size: 42px;
    letter-spacing: 2px;
}

dialog p,
dialog li {
    font-size: 22px;
    line-height: 1.5;
    color: #3b2a14;
}

dialog h2 {
    font-size: 34px;
    margin-top: 20px;
}

dialog h3 {
    font-size: 28px;
    margin-top: 16px;
}

.btnDialogClose {
    font-size: 28px;
}

@keyframes dialogPop {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }

    60% {
        transform: scale(1.05);
        opacity: 1;
    }

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

/* ############## rotate ######## */
#rotate-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    color: white;
    font-family: 'lato', sans-serif;
    text-align: center;
    padding: 20px;
    gap: 20px;
    display: none;
    /* Start hidden */
}

#rotate-overlay img {
    width: 180px;
    height: auto;
    opacity: 0.9;
}

#rotate-overlay p {
    font-size: 22px;
    line-height: 1.4;
}


@media screen and (max-height: 420px){
    body {
        background-image: none;
        margin: 0 0;
    }

    .onlyDesktop {
        display: none;
    }

    .onlyMobile {
        display: block;
    }

    #game-container {
        width: 100vw;
        height: 100vh;
    }

    canvas {
        width: 100vw !important;
        height: 100vh !important;
    }

    #mobile-controls {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
    }

    #header {
        position: absolute;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
    }

}

@media screen and (max-height: 600px), (pointer: coarse) {
    body {
        background-image: none;
        margin: 0 0;
    }

    .onlyDesktop {
        display: none;
    }

    .onlyMobile {
        display: block;
    }

    #game-container {
        width: 100vw;
        height: 100vh;
    }

    canvas {
        width: 100vw !important;
        height: 100vh !important;
    }

    #mobile-controls {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
    }

    #header {
        position: absolute;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (pointer: coarse) {

    .gameButton:hover,
    footer button:hover,
    .btnDialogClose:hover {
        transform: none !important;
        box-shadow: none !important;
        border-color: inherit !important;
        text-shadow: none !important;
    }
}