body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
}

.container {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 880px;
    max-height: 95vh;
    background-color: #f2f2f2;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#masterbild {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    transition: opacity 0.3s ease-in-out;
}

.nested-grid {
    opacity: 0;
    pointer-events: none;
}

.grid-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid transparent;
    text-align: center;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.grid-cell a {
    text-decoration: none;
    color: yellow;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

/* CSS für die Grid-Navigation */
#grid-main:target ~ .nested-grid {
    opacity: 0;
    pointer-events: none;
}

#grid-main:target,
.nested-grid:target {
    opacity: 1;
    pointer-events: auto;
}

@media (max-aspect-ratio: 600/880) {
    .container {
        width: auto;
        height: 95vh;
    }
    #masterbild {
        width: auto;
        height: 100%;
    }
}

@media (min-aspect-ratio: 600/880) and (max-height: 926px) {
    .container {
        width: calc(100vh * 600 / 880 * 0.95);
        height: 95vh;
    }
}
