:root {
    --light-violet: #AA88C4;
    --dark-violet: #75568E;
    --dark: #26263A;
    --aspect-ratio-index: calc(16 / 11);
}

@font-face {
    font-family: Oswald;
    src: url("../font/oswald.ttf");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Oswald;
}

body {
    display: flex;
    justify-content: center;
}

.index_all {
    margin-top: 5%;
    width: min(95%, calc(100vh * var(--aspect-ratio-index)));
    display: flex;
    flex-direction: column;
    align-items: center;
}

.title {
    font-size: 70px;
    line-height: 1;
}

p {
    font-size: 32px;
}

/*CSS für index.html*/

.index_header {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.spacer {
    width: 150px;
}

/* Spielinfo-Button oben rechts */
.spielinfo_button {
    background: var(--light-violet);
    color: white;
    border: none;
    width: 150px;
    height: 90px;
    font-size: 24px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: background 0.2s ease, transform 0.2s ease;
}

.spielinfo_button:hover {
    cursor: pointer;
    background: var(--dark-violet);
}

/* Overlay (Spielinfo) */
/* Ausgeblendet: Overlay rutscht außerhalb des Bildschirms über dem Viewport */
#spielinfo_overlay {
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;

    /* Startposition oberhalb des Viewports */
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;

    /* Übergang für Slide + Fade */
    transition: transform 0.4s ease, opacity 0.4s ease, visibility 0s linear 0.4s;
}

/* Sichtbar: Overlay ist an seiner normalen Position */
#spielinfo_overlay.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    /* Sichtbar sofort, erst nach Transition ausgeblendet */
    transition: transform 0.4s ease, opacity 0.4s ease, visibility 0s;
}


/* Inhalt des Overlays */
.overlay_content {
    position: relative;
    color: white;
    background-color: var(--dark-violet);
    padding: 40px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* Schließen-Button */
#close_overlay {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
}

/* Icon selbst anpassen */
#close_overlay img {
    transition: transform 0.2s ease;
    width: 40px;
    height: 40px;
}

/* Hover-Effekt */
#close_overlay:hover img {
    transform: rotate(20deg) scale(1.1);
}

.index_main {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.index_main p {
    text-align: center;
    margin-top: 50px;

}

.country {
    margin-top: 20px;
    display: flex;
    gap: 3%;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;

}

.country_button {
    background: white;
    border: none;
    padding: 0;
    border-radius: 10px;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    cursor: pointer;
    width: 30%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s;
    position: relative;
}

.country_button:hover {
    transform: scale(1.03);
}

.country p {
    margin: 0;
}

.country_name {
    background-color: var(--dark-violet);
    color: white;
    font-weight: bold;
    padding: 1rem 0;
    width: 100%;
    text-align: center;
    margin: 0;
}


.austria_img {
    mask: url("../img/austria.svg")
}

.switzerland_img {
    mask: url("../img/switzerland.svg")
}

.germany_img {
    mask: url("../img/germany.svg")
}

.country_img {
    display: block;
    width: 100%;
    height: 300px;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    background-color: var(--dark-violet);
    transition: .25s ease-in;
}

.country_button {
    position: relative;
    overflow: hidden;
}

.highscore {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 14px;
    color: var(--dark-violet);
    padding: 4px 6px;
    border-radius: 4px;
    z-index: 2;
    pointer-events: none;
    /* verhindert, dass Klick blockiert wird */
}


/*CSS für play.html*/
.play_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.home_link {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    text-decoration: none;
    color: var(--dark);
    font-size: 48px;
    transition: .25s ease-in;
    position: relative;
}

.home_icon {
    width: 50px;
    height: 50px;
    mask: url("../img/home.svg");
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    background-color: var(--dark);
    transition: .25s ease-in;
}

.home_link p {
    margin-left: 10px;
    line-height: 1;
}

.home_link:hover {
    color: var(--dark-violet);
}

.home_link:hover .home_icon {
    background-color: var(--dark-violet);
}

.game {
    margin-top: 2%;
    width: 100%;
}

.game_text {
    display: flex;
    justify-content: space-between;
}

#distance_text {
    display: none;
}

.station {
    display: flex;
    justify-content: space-between;
}

.station_container {
    margin-top: 1%;
    width: 49%;
    aspect-ratio: 5/3;
    border: 4px solid var(--dark-violet);
    box-shadow: 3px 3px 3px var(--dark);
    object-fit: cover;
}

.station_container img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    transition: transform 0.3s ease;
}

#station_img_wrapper {
    position: relative;
    overflow: hidden;
    cursor: zoom-in;
    transition: cursor 0.2s;
}

.zoomed {
    cursor: zoom-out !important;
}

/* CSS für end.html */
.end_header {
    display: flex;
    justify-content: center;
}

.end_message {
    margin: 10% auto;
    width: 600px;
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.end_message p {
    text-align: center;
}

.t_mobile {
    display: none;
}

.train_path {
    position: absolute;
    top: 0;
    left: 0;
    width: 600px;
    height: 400px;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

.train {
    offset-path: path("M20 0 H580 A20 20 0 0 1 600 20 V380 A20 20 0 0 1 580 400 H20 A20 20 0 0 1 0 380 V20 A20 20 0 0 1 20 0 Z");
    offset-rotate: auto;
    animation: ride 25s linear infinite;
    offset-distance: 0%;
    display: block;
}

.train_head {
    width: 60px;
    height: 60px;
    animation-delay: calc((var(--index) * -.55s) - .12s);
    transform: translate(-30px, -30px);
}

.train_car {
    width: 40px;
    height: 60px;
    animation-delay: calc((var(--index) * -.55s));
    transform: translate(-20px, -30px);
}

@keyframes ride {
    0% {
        offset-distance: 0%;
    }

    100% {
        offset-distance: 100%;
    }
}

/* CSS für Button Animation */
.button_wrapper {
    margin-top: 3%;
    display: flex;
    justify-content: center;
}

.nav_button {
    font-size: 48px;
    background-color: white;
    border: 4px solid var(--dark);
    box-shadow: 3px 3px 3px var(--dark);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    width: 300px;
    height: 90px;
    cursor: pointer;
}

.nav_button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav_button .button_text,
.nav_button .arrow_icon {
    position: absolute;
    top: 50%;
    transition: all 0.5s ease;
    white-space: nowrap;
}

.nav_button .button_text {
    transform: translate(-50%, -50%);
    left: 50%;
}


.nav_button .arrow_right {
    mask: url("../img/arrow_right_icon.svg");
    transform: translate(0, -50%);
    left: -100px;
}

.nav_button .arrow_left {
    mask: url("../img/arrow_left_icon.svg");
    transform: translate(-50%, -50%);
    left: 400px;
}

.nav_button .arrow_icon {
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    width: 65px;
    height: 50px;
    background-color: var(--dark-violet);
    opacity: 0;
}

.nav_button:not(:disabled):hover {
    border-color: var(--dark-violet);
}

.nav_button:not(:disabled):hover #game_button_text {
    left: 500px;
    opacity: 0;
}

.nav_button:hover .home_button_text {
    left: -500px;
    opacity: 0;
}

.nav_button:not(:disabled):hover .arrow_icon {
    transform: translate(-50%, -50%);
    left: 50%;
    opacity: 1;
}

@media (max-width: 1000px) {
    p {
        font-size: 30px;
    }

    .title {
        font-size: 50px;
    }

    /*CSS für index.html*/
    .index_header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .index_header .title {
        order: 1;
    }

    .spielinfo-button {
        align-self: flex-end;
        width: 80px;
        height: 50px;
        font-size: 18px;
    }

    .spacer {
        display: none;
    }

    .index_main {
        margin-top: 15px;
    }

    .selection_text {
        display: none;
    }

    .country {
        margin: 0;
        flex-direction: column;
        gap: 20px;
    }

    .country_button {
        width: 100%;
        height: 170px;
    }

    .country_img {
        height: 170px;
    }

    .country_name {
        padding: .5rem;
    }

    /*CSS für play.html*/

    .home_icon {
        width: 45px;
        height: 45px;
    }

    .game_text {
        margin-top: 14px;
    }
}

@media (max-width: 700px) {
    p {
        font-size: 28px;
    }

    .index_all {
        margin: 4% 10%;
    }

    /*CSS für play.html*/
    .play_header .title {
        display: none;
    }

    .home_icon {
        width: 40px;
        height: 40px;
    }

    .home_text {
        display: none;
    }

    .round_and_score {
        display: flex;
        gap: 28px;
    }

    .game_text {
        margin-top: 14px;
    }

    .station {
        margin: 14px 0;
        flex-direction: column;
        gap: 14px;
    }

    .station_container {
        width: 100%;
        aspect-ratio: 8/3;
    }

    .button_wrapper {
        width: 100%;
    }

    #game_button {
        width: 100%;
    }

    /*CSS für end.html*/
    .end_message {
        width: 280px;
        margin: 5px;
        height: 600px;
    }

    .t_desktop {
        display: none;
    }

    .t_mobile {
        display: block;
    }

    .train_path {
        top: 0px;
        left: -20px;
        width: 320px;
        height: 600px;
    }

    .train {
        animation: ride 18s linear infinite;
    }

    .t_mobile .train {
        offset-path: path(" M20 0 H300 A20 20 0 0 1 320 20 V380 A20 20 0 0 1 300 400 H20 A20 20 0 0 1 0 380 V20 A20 20 0 0 1 20 0 Z ");
    }

    .train_head {
        animation-delay: calc((var(--index) * -.55s) - .12s);
    }

    .train_car {
        animation-delay: calc((var(--index) * -.55s));
    }

    /*Nav-Button*/
    .nav_button {
        font-size: 36px;
        height: 80px;
    }
}

@media (max-width: 630px) {

    /*CSS für play.html*/
    .game_text p {
        font-size: 24px;
    }

    #distance_text {
        text-align: end;
    }

    .station_container {
        aspect-ratio: 7/3;
    }
}

@media (max-width: 570px) {

    /*CSS für play.html*/
    .game_text p {
        font-size: 22px;
    }

    .station_container {
        aspect-ratio: 6/3;
    }
}

@media (max-width: 500px) {

    .title {
        font-size: 40px;
    }

    /*CSS für play.html*/
    .game_text p {
        font-size: 18px;
    }

    .station_container {
        aspect-ratio: 5/3;
    }
}

@media (max-width: 400px) {

    /*CSS für play.html*/
    .station_container {
        aspect-ratio: 4/3;
    }
}