/* =========================================================
   GLOBAL BASE STYLES
   ========================================================= */
body {
    font-family: Montserrat;
    font-size: 32px;
    background-color: rgb(59, 56, 56);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@font-face {
    font-family: 'NinjaNaruto';
    src: url('styles/fonts/njnaruto.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

main {
    flex: 1;
}

h1 {
    position: absolute;
    right: 160px;
}


/* =========================================================
   HEADER & FOOTER
   ========================================================= */
header {
    font-family: 'NinjaNaruto', sans-serif;
    font-style: normal;
    height: 100px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    background-color: #B7694D;
    color: #493731;
    text-shadow: 2px 2px 4px rgba(205, 203, 203, 0.6);
}

header img {
    width: 100px;
    margin-left: 24px;
    margin-right: 16px;
}

footer {
    display: flex;
    background-color: #B7694D;
    justify-content: flex-start;
    flex-direction: column;
    height: 100px;
}

footer img {
    width: 60px;
    height: 60px;
    margin-right: 16px;
    margin-bottom: 18px;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background-color: #B7694D;
}

.signature {
    font-family: "Kalam";
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    color: rgb(221, 221, 221);
}

.under-signature {
    display: flex;
    justify-content: center;
    font-size: 12px;
    color: rgb(192, 192, 192);
    margin-bottom: 16px;
    margin-top: 0;
}


/* =========================================================
   CANVAS & CANVAS WRAPPER
   ========================================================= */
#canvas-box {
    display: flex;
    justify-content: center;
    align-items: center;

    /* canvas area should grow into available space */
    flex: 1 1 auto;

    background-image: url('img/index/background.jpg');
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

canvas {
    width: auto;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}


/* =========================================================
   FULLSCREEN MODE FIXES
   ========================================================= */

/* Header & Footer NUR verstecken, wenn SPIEL läuft UND Fullscreen aktiv ist */ /* CHANGED */
html:fullscreen body.game-running header,
html:fullscreen body.game-running footer {
    display: none;
}

/* Scrollen in Fullscreen nur im Spiel deaktivieren */ /* CHANGED */
html:fullscreen body.game-running {
    overflow: hidden;
}

/* canvas container füllt Fullscreen nur im Spiel */ /* CHANGED */
html:fullscreen body.game-running #canvas-box {
    height: 100vh;
}

/* canvas füllt Fullscreen, Seitenverhältnis bleibt erhalten – nur im Spiel */ /* CHANGED */
html:fullscreen body.game-running canvas {
    height: 100vh;
    width: auto;
    max-width: none;
    max-height: none;
}


/* =========================================================
   START OVERLAY / STORY / IMPRESSUM
   ========================================================= */
#startoverlay,
#story,
#impressum {
    position: fixed;
    top: 49.5%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #b7694dec;
    border-radius: 10px;
    color: #fff;
    font-family: 'NinjaNaruto', sans-serif;
    z-index: 1000;
    border: 1px solid #473631;
    display: none;
}

#story {
    min-height: 400px;
    min-width: 790px;
    flex-direction: column;
    height: 62%;
}

/* main menu overlay: centered, classic size */
#startoverlay {
    padding-top: 30px;
    width: 60%;
    height: 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* container for main buttons (Start / Controls / Story) */
#startoverlay .menu-main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* main buttons in desktop */
#startoverlay .menu-main button {
    width: 200px;
    margin: 0;
}

/* impressum button below menu */
#startoverlay .impressum-button {
    margin-top: 12px;
    background-color: transparent;
    border: none;
    text-decoration: underline;
    cursor: pointer;
}

/* story headline */
.story-headline {
    background-color: #473630;
    color: rgb(241, 241, 241);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'NinjaNaruto', sans-serif;
    height: 48px;
    border-radius: 10px 10px 0 0;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    padding: 16px 0;
    >h2 {
        font-size: 36px;
    }
}

/* story text */
.background-story {
    padding-top: 14px;
    padding-right: 24px;
    padding-left: 24px;
    font-size: 20px;
}

.background-story p {
    margin-top: 0;
    margin-bottom: 0;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

/* impressum overlay */
#impressum {
    font-family: Arial, Helvetica, sans-serif;
    min-width: 700px;
    flex-direction: column;
    height: 60%;
}

.impressum-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 12px;
    flex: 1;
    >p {
        flex: 1;
        margin-top: 10px;
        margin-bottom: 0;
        font-size: 24px;
        text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    }
}

.impressum-button {
    background-color: transparent;
    text-decoration: underline;
}

.impressum-button:hover {
    color: rgb(59, 58, 58);
}

.email-link {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 24px;
}

.email-link a {
    color: rgb(205, 203, 203);
    text-decoration: none;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

.email-link a:hover {
    color: rgb(57, 57, 57);
}


/* =========================================================
   CONTROL OVERLAY
   ========================================================= */
#control {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 800px;
    height: 60%;
    background-color: #b7694dec;
    border-radius: 10px;
    border: 1px solid #473631;
    color: #fff;
    font-family: 'Noto Sans', sans-serif;
    z-index: 1000;
    display: none;          /* hidden by default, JS switches to flex */
    flex-direction: column;
}

.control-headline {
    background-color: #473631;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'NinjaNaruto', sans-serif;
    height: 24px;
    border-radius: 10px 10px 0 0;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    padding: 24px;
    >h2 {
        font-size: 36px;
    }
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}

.controls span {
    padding: 12px;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

.control-button {
    display: flex;
    flex-direction: column;
}

.control-button-style {
    display: flex;
    align-items: center;
    font-size: 24px;
    button {
        height: 32px;
        padding: 0;
    }
}

.control-button-style img {
    width: 30px;
    filter: invert();
}

.control-container {
    padding-top: 16px;
    font-family: 'NinjaNaruto', sans-serif;
    font-size: 24px;
    display: flex;
    justify-content: center;
    flex: 1 1 auto;
    align-items: center;
    overflow-y: auto;
}

.menu-button {
    display: flex;
    justify-content: center;
    padding: 16px;
    flex: 0 0 auto;
}


/* =========================================================
   SOUND & FULLSCREEN BUTTONS
   ========================================================= */
.sound-button,
.fullscreen-button {
    position: fixed;
    right: 8px;
}

.sound-button {
    top: 150px;
    display: none;
}

.fullscreen-button {
    top: 210px;
}

.sound-button img,
.fullscreen-button img {
    width: 38px;
    background-color: rgba(18,18,18,0.48);
    filter: invert();
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
}

.sound-button img:hover,
.fullscreen-button img:hover {
    background-color: rgba(18,18,18,0.28);
}

#mute-btn {
    display: block;
}


/* =========================================================
   BUTTONS (GLOBAL)
   ========================================================= */
button {
    background-color: #292929c6;
    color: #efefef;
    width: 200px;
    font-size: 20px;
    padding: 15px 30px;
    margin: 10px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #666;
}


/* =========================================================
   GAME OVER & WIN OVERLAYS
   ========================================================= */
#game-over-overlay,
#win-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 600px;
    height: 50%;
    background-color: #b7694dec;
    border-radius: 10px;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-family: 'Noto Sans', sans-serif;
    z-index: 1100;
}

#game-over-overlay h2,
#win-overlay h2 {
    margin-bottom: 20px;
    font-family: 'NinjaNaruto', sans-serif;
    font-size: 48px;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

.overlay-buttons {
    gap: 20px;
}


/* =========================================================
   MOBILE: ROTATE OVERLAY & TOUCH CONTROLS
   ========================================================= */

/* portrait warning overlay */
.rotate-overlay {
    position: fixed;
    inset: 0;
    background: black;
    z-index: 1200;
    display: none;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.rotate-overlay .rotate-message {
    color: #fff;
    font-size: 1.4rem;
}

/* touch controls wrapper */
.touch-controls {
    position: fixed;
    inset: auto 0 0 0;
    height: 30vh;
    display: none;
    z-index: 1150;
    pointer-events: none;
}

/* joystick (left) */
.touch-joystick {
    position: absolute;
    left: 10px;
    bottom: 10px;
    pointer-events: none;
}

.joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(0,0,0,0.5);
    position: relative;
    pointer-events: auto;
}

.joystick-thumb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(255,255,255,0.1);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* action buttons (right) */
.touch-actions {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    gap: 10px;
}

.touch-btn {
    pointer-events: auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 1.4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

/* desktop → always hide touch controls */
@media (hover: hover) and (pointer: fine) {
    .touch-controls {
        display: none !important;
    }
}


/* =========================================================
   DESKTOP: SCREEN TOO SMALL OVERLAY (NON-TOUCH)
   ========================================================= */
.screen-too-small-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.96);
    display: none;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1300;
}

.screen-too-small-message {
    color: #ffffff;
    font-size: 2rem;
    font-family: 'NinjaNaruto', sans-serif;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.8);
}
