body {
    background-color: #dddddd;
    color: #222;
    font-family: Arial, sans-serif;
    margin: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.gfsviewer-center {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    padding: 0 12px 20px;
}

.gfsviewer {
    background-color: #dddddd;
    width: min(100%, 840px);
    padding: 0;
    border-radius: 8px;
}

.viewer-title,
.overlay-row,
.controls,
#kaartinfo,
#nawoord,
.overlay-container {
    width: min(100%, 800px);
    margin-left: auto;
    margin-right: auto;
}

.viewer-title {
    margin: 0 auto 10px;
}

.overlay-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 13px;
    margin-bottom: 10px;
    background: #f2f2f2;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.overlay-container {
    position: relative;
    aspect-ratio: 1162 / 648;
    overflow: hidden;
}

#baseimg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.overlayimg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    z-index: 2;
    background-color: transparent !important;
}

#kaartinfo {
    margin-top: 10px;
    font-size: 14px;
    color: #333;
    background: #f2f2f2;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 3;
}

#kaartinfo div {
    white-space: nowrap;
}

#kaartinfo-midden {
    flex: 1 1 220px;
    text-align: center;
}

#nawoord {
    margin: 20px auto 40px;
    background: #f2f2f2;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

#nawoord h3 {
    margin-top: 0;
}

@media (max-width: 900px) {
    .gfsviewer {
        width: 100%;
    }

    .viewer-title,
    .overlay-row,
    .controls,
    #kaartinfo,
    #nawoord,
    .overlay-container {
        width: 100%;
        max-width: 800px;
    }

    #kaartinfo div {
        white-space: normal;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14px;
    }

    .gfsviewer-center {
        margin-top: 12px;
        padding: 0 8px 16px;
    }

    .viewer-title {
        font-size: 1.2rem;
        line-height: 1.3;
        margin-bottom: 8px;
    }

    .overlay-row,
    .controls,
    #kaartinfo,
    #nawoord {
        padding-left: 10px;
        padding-right: 10px;
    }

    .overlay-row {
        gap: 8px 10px;
        font-size: 12px;
    }

    .overlay-row label {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .controls {
        gap: 8px;
    }

    #imgselect {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        font-size: 16px;
        padding: 10px 12px;
    }

    #prevbtn,
    #playbtn,
    #nextbtn {
        flex: 1 1 calc(33.333% - 6px);
        min-height: 44px;
        font-size: 18px;
    }

    #kaartinfo {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    #kaartinfo-midden {
        flex: none;
        text-align: left;
    }

    #nawoord {
        font-size: 13px;
        line-height: 1.45;
    }
}
