html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-image: url('./assets/img/Background/mexikanische_Landschaft.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

h1 {
    margin-top: 4px;
    margin-bottom: 0;
    font-family: "Rye", Arial, Helvetica, sans-serif;
    font-size: 52px;
    color: #c6662f;
}

canvas {
    background-color: black;
}

.game_area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

#canvas {
    width: 720px;
    height: 480px;
    max-width: 95vw;
    max-height: 90vh;
    display: block;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.start_screen img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    z-index: 0;
}

.game_button {
    position: absolute;
    bottom: 25%;
    margin-top: 16px;
    padding: 12px 24px;
    font-family: "Rye", Arial, Helvetica, sans-serif;
    font-size: 20px;
    color: #ffffff;
    background-color: #c6662f;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s ease;
    z-index: 2000;
}

.endscreen_actions {
    display: none;
    position: absolute;
    left: 50%;
    bottom: 16%;
    transform: translateX(-50%);
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 2300;
}

.endscreen_actions.visible {
    display: flex;
}

.endscreen_actions .game_button {
    position: static;
    margin-top: 0;
    bottom: auto;
}

#retry-button:hover,
#home-button:hover,
#start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.35);
}

.d_none {
    display: none !important;
}

.canvas_info_buttons {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: min(700px, calc(95vw - 20px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2100;
}

/* Audio controls positioned top-right over the canvas */
.audio_controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2200;
    background: rgba(0, 0, 0, 0.18);
    padding: 6px 8px;
    border-radius: 10px;
}

.audio_label {
    background: transparent;
    border: none;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#audio-slider {
    width: 140px;
    max-width: 100%;
}

/* Wrapper to position the slider dialog under the label button */
.audio_label_wrap {
    position: relative;
    display: inline-block;
}

/* Anchor the slider dialog to the right edge of the label by default
   so it opens to the left and won't overflow the canvas on the right. */
.audio_label_wrap .audio_slider_dialog {
    right: 0;
    left: auto;
    transform-origin: right top;
}

.audio_slider_dialog {
    position: absolute;
    top: calc(100% + 8px);
    display: none;
    background: rgba(0, 0, 0, 0.9);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    z-index: 2300;
    pointer-events: auto;
    right: 0;
    max-width: 220px;
}

.audio_slider_dialog.open {
    display: block;
}

/* Keep the slider compact on small screens */
@media (max-width: 480px) {
    #audio-slider {
        width: 110px;
    }
}

.canvas_info_button {
    border: none;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;
    font-family: "Rye", Arial, Helvetica, sans-serif;
    font-size: 15px;
    padding: 9px 14px;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.15s ease;
}

.canvas_info_button:hover {
    transform: translateY(-1px);
    background: rgba(198, 102, 47, 0.92);
}

.info_overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.66);
    z-index: 2600;
}

.info_overlay_card {
    width: min(700px, 95vw);
    max-height: min(80vh, 430px);
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: #fff3df;
    color: #2d1707;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.info_overlay_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #c6662f;
    color: #fff;
}

.info_overlay_header h2 {
    margin: 0;
    font-family: "Rye", Arial, Helvetica, sans-serif;
    font-size: 24px;
}

.info_close_button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.info_overlay_body {
    padding: 14px 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 9px;
    line-height: 1.35;
    font-family: Arial, Helvetica, sans-serif;
}

.info_overlay_body h3 {
    margin-top: 4px;
    margin-bottom: 4px;
    font-family: "Rye", Arial, Helvetica, sans-serif;
    font-size: 19px;
    color: #8b4513;
}

.start_screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1000;
}

.start_screen.hidden {
    display: none;
}