@font-face {
    font-family: 'Luckiest Guy';
    src: url('../fonts/LuckiestGuy-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #0a1628;
    background-image: url('../img/ui/screens/page-background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    font-family: 'Luckiest Guy', sans-serif;
}

#game-container {
    position: relative;
    width: min(1000px, 100vw, calc(100vh * 720 / 480));
    aspect-ratio: 720 / 480;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 100, 200, 0.3);
}

.audio-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mute-button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid white;
    background: rgba(75, 26, 107, 0.75);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mute-button img {
    width: 18px;
    height: 18px;
}

.volume-slider {
    width: 80px;
    accent-color: #7ee8c4;
    cursor: pointer;
}

.overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding-top: 54px;
    border-radius: 4px;
    background-color: rgba(10, 22, 40, 0.85);
    background-size: cover;
    background-position: center;
}

.hidden {
    display: none;
}

.game-title {
    font-size: min(48px, 9vh);
    color: white;
    -webkit-text-stroke: 0.06em #4b1a6b;
    text-stroke: 0.06em #4b1a6b;
    letter-spacing: 2px;
    margin: 0;
}

.controls-box {
    background: rgba(75, 26, 107, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-line {
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 14px;
    color: white;
    font-size: 16px;
}

.control-row img {
    height: min(46px, 8vh);
    width: auto;
}

.button {
    width: min(160px, 35vw);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.button:hover {
    transform: scale(1.05);
}

.text-link {
    background: none;
    border: none;
    color: white;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Luckiest Guy', sans-serif;
}

.end-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#end-title {
    width: min(300px, 45vw);
}

#end-title.hidden {
    display: none;
}

#end-screen.win-mode {
    justify-content: flex-start;
    padding-top: 32px;
}

.impressum-box {
    background: white;
    color: #222;
    padding: 24px 32px;
    border-radius: 8px;
    min-width: 240px;
    max-width: 320px;
    text-align: center;
}

.impressum-box h2 {
    margin-bottom: 16px;
}

.impressum-box p {
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.impressum-box .text-link {
    color: #222;
    margin-top: 8px;
}

#mobile-controls {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
}

#mobile-controls.hidden {
    display: none;
}

.dpad {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: grid;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
    pointer-events: auto;
}

.attack-pad {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

.mobile-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid white;
    background: rgba(126, 232, 196, 0.85);
    color: #4b1a6b;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.attack-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    font-size: 10px;
    text-align: center;
    padding: 4px;
}

#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: black;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.phone {
    height: 100px;
    width: 50px;
    border: 3px solid white;
    border-radius: 10px;
    animation: rotate 1.5s ease-in-out infinite alternate;
}

.message {
    color: white;
    font-family: 'Luckiest Guy', sans-serif;
    font-size: 18px;
    margin-top: 40px;
    max-width: 320px;
    text-align: center;
    padding: 0 24px;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(-90deg);
    }
    100% {
        transform: rotate(-90deg);
    }
}

@media (hover: none) and (orientation: landscape) {
    #mobile-controls {
        display: block;
    }
}

@media (hover: none) and (orientation: portrait) {
    #rotate-overlay {
        display: flex;
    }
}
