@font-face {
    font-family: 'Lilita One';
    src: url('fonts/LilitaOne-Regular.ttf');
}

html, body {
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-image: url('img/Desert.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin: 0;
    font-family: 'Lilita One', cursive;
}

h1 {
    font-family: 'Lilita One', cursive;
    color: #f5a623;
    font-size: 48px;
    margin: 0 0 16px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

#game-container {
    position: relative;
    width: 720px;
    height: 480px;
    aspect-ratio: 720 / 480;
    max-width: 100vw;
    max-height: 90vh;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
    margin-top: 16px;
}

canvas {
    background-color: black;
    width: 100%;
    height: 100%;
    display: block;
}

.hidden {
    display: none !important;
}

#start-screen, .end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#start-screen img, .end-screen img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

#start-button {
    position: absolute;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 40px;
    font-size: 24px;
    background-color: #f5a623;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Lilita One', cursive;
}

#start-button:hover {
    background-color: #e09000;
}

#controls-button {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 30px;
    font-size: 18px;
    background-color: #f5a623;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Lilita One', cursive;
}

#controls-button:hover {
    background-color: #e09000;
}

#impressum-link {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-family: 'Lilita One', cursive;
    font-size: 16px;
    text-decoration: underline;
    cursor: pointer;
}

#impressum-link:hover {
    color: #f5a623;
}

.end-buttons {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
}

.end-buttons button {
    padding: 12px 30px;
    font-size: 18px;
    background-color: #f5a623;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Lilita One', cursive;
}

.end-buttons button:hover {
    background-color: #e09000;
}

#audio-controls {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

#mute-button {
    width: 36px;
    height: 36px;
    font-size: 16px;
    background-color: rgba(245, 166, 35, 0.9);
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#mute-button:hover {
    background-color: #e09000;
}

#volume-slider {
    width: 100px;
    cursor: pointer;
    accent-color: #f5a623;
}

#rotate-hint {
    display: none;
}

#touch-controls {
    display: none;
}

@media (pointer: coarse) {
    #touch-controls {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        display: flex;
        justify-content: space-between;
        padding: 20px;
        box-sizing: border-box;
        z-index: 20;
        pointer-events: none;
    }
}

.touch-left, .touch-right {
    display: flex;
    gap: 16px;
    pointer-events: auto;
}

.touch-btn {
    width: 45px;
    height: 45px;
    font-size: 20px;
    background-color: rgba(245, 166, 35, 0.85);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

#controls-dialog {
    border: none;
    border-radius: 12px;
    padding: 0;
    background: transparent;
}

#controls-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.dialog-content {
    position: relative;
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    font-family: 'Lilita One', cursive;
    min-width: 280px;
}

.dialog-content h2 {
    margin: 0 0 20px;
    color: #f5a623;
    text-align: center;
}

.dialog-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dialog-content li {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.dialog-content li span {
    font-weight: bold;
    color: #333;
}

.dialog-hint {
    margin-top: 20px;
    font-size: 14px;
    color: #888;
    text-align: center;
}

.dialog-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5a623;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}

.dialog-close:hover {
    background: #e09000;
}

.impressum-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    font-family: 'Lilita One', cursive;
    color: #333;
}

.impressum-container h1 {
    color: #f5a623;
    text-shadow: none;
    margin-top: 0;
}

.impressum-container h2 {
    color: #333;
    font-size: 20px;
    margin-top: 24px;
}

.impressum-note {
    margin-top: 30px;
    font-size: 14px;
    color: #888;
}

.impressum-back {
    display: inline-block;
    margin-top: 24px;
    color: #f5a623;
    text-decoration: none;
    font-size: 18px;
}

.impressum-back:hover {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    h1 {
        display: none;
    }

    #game-container {
        margin-top: 0;
        max-height: 100vh;
    }
}

@media (orientation: portrait) and (max-width: 1024px) {
    #rotate-hint {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #222;
        color: #f5a623;
        z-index: 1000;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-family: 'Lilita One', cursive;
        font-size: 24px;
        padding: 20px;
        box-sizing: border-box;
    }

    #game-container, h1 {
        display: none;
    }
}

@media (pointer: coarse) and (min-width: 900px) {
    #touch-controls {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100vw;
    }
    .touch-btn {
        width: 70px;
        height: 70px;
        font-size: 32px;
    }
}