html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
    font-size: 1rem;
}

header {
    background-color: #820e20;
    color: white;
    padding: 0.625rem 1.25rem;
    display: flex;
    align-items: center;
    height: 5vh;
    flex-shrink: 0;
}

header .logo {
    height:  clamp(2.5rem, 4vw, 6rem);
    margin-right: 1.25rem;
}

header h1 {
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 3.5rem);
    flex-grow: 1;
    text-align: center;
}

#content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#lewy {
    flex: 1;
    padding: 1.25rem;
    box-sizing: border-box;
    background: white;
    overflow: hidden;
}

#prawy {
    flex: 0 0 auto;
    box-sizing: border-box;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#prawy img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#srodek {
    width: 20vw;
    padding: 1.25rem;
    box-sizing: border-box;
    background: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.625rem rgba(0, 0, 0, 0.1);
    margin: 0 1.25rem;
    overflow: hidden;
}

#godzina {
    width: 100%;
    flex: 0 0 auto;
    font-size: clamp(2rem, 8vh, 10rem);
    font-weight: bold;
    color: #333;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 0.125rem solid #ddd;
    padding-bottom: 0.625rem;
}

#godzina p {
    margin: 0;
}

#pogoda {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#pogoda p {
    margin: 0.3125rem 0;
    font-size: clamp(1rem, 2vw, 1.25rem);
}

#pogoda .temp {
    font-size: clamp(2rem, 5vw, 10rem);
    font-weight: bold;
    color: #333;
}

#pogoda .desc {
    font-size: clamp(1rem, 1.5vw, 5rem);
    font-weight: 500;
    color: #666;
}

#pogoda .wind {
    font-size: clamp(0.9rem, 1.5vw, 5rem);
    font-weight: 400;
    color: #888;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 0 0.625rem rgba(0, 0, 0, 0.1);
}

table, th, td {
    border: 0;
}

th, td {
    padding: 0.5rem;
    text-align: left;
    font-size: clamp(0.9rem, 1.2vw, 10rem);
}

th {
    background-color: #747474;
    color: white;
}

tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

th:first-child, td:first-child {
    width: clamp(1rem, 3rem, 5rem);
    padding: 0;
}

td:first-child img {
    display: block;
    margin: auto;
}

@media screen and (min-width: 1025px) {
    #prawy {
        display: flex !important;
    }

    .show-map-btn {
        display: none !important;
    }
}

@media screen and (max-width: 1024px) {
    body {
        height: auto;
        overflow: scroll !important;
    }

    header {
        height: auto;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    #content {
        flex-direction: column;
        overflow: visible;
    }

    #lewy, #srodek {
        width: 100%;
        margin: 0.625rem 0;
    }

    #lewy {
        order: 2;
        overflow: visible;
    }

    #srodek {
        order: 1;
        padding-bottom: 0;
    }

    #godzina {
        font-size: clamp(2rem, 3rem, 5rem);
        margin-bottom: 0.625rem;
    }

    #pogoda {
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
        padding: 1rem;
    }

    #pogoda img {
        width: clamp(3rem, 4rem, 5rem);
    }

    #pogoda .temp {
        font-size: clamp(1.8rem, 2rem, 3rem);
    }

    #pogoda .weather-data {
        display: flex;
        flex-direction: column;
    }

    #pogoda .desc,
    #pogoda .wind {
        font-size: clamp(0.9rem, 1rem, 1.2rem);
    }

    #prawy.map_hidden {
        display: none !important;
    }
    th:first-child, td:first-child {
        width: clamp(1rem, 2rem, 4rem);
        padding: 0;
    }
    table, th, td {
        border: 0;
    }
    td {
        padding: 0.5rem;
        text-align: left;
        font-size: clamp(0.5rem, 0.8rem, 1rem);
        word-wrap: break-word;
        white-space: normal;
        overflow-wrap: break-word;
        height: 0.3rem;
    }
    .stop-icon{
        width: 2rem;
    }

    #map-popup {
        border-radius: 12px;
        box-shadow: 0 0 20px rgba(0,0,0,0.4);
    }
    #map-popup .close-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        background: #fff;
        border: none;
        font-size: 24px;
        font-weight: bold;
        padding: 5px 10px;
        border-radius: 50%;
        box-shadow: 0 0 5px rgba(0,0,0,0.3);
        cursor: pointer;
        z-index: 1000;
    }

}

/* Fallback dla przeglądarek bez clamp() */
@supports not (width: clamp(10px, 5vw, 100px)) {

    header { height: 4.5vh; }

    header .logo { height: 2rem; }
    @media (min-width: 900px)  { header .logo { height: 3vw; } }
    @media (min-width: 1800px) { header .logo { height: 3.5rem; } }

    header h1 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        text-align: center;
    }
    @media (min-width: 800px)  { header h1 { font-size: 1.4vw; } }
    @media (min-width: 1400px) { header h1 { font-size: 2rem; } }

    #godzina { font-size: 2rem; }
    @media (min-height: 260px) { #godzina { font-size: 7vh; } }
    @media (min-height: 1200px){ #godzina { font-size: 10rem; } }

    #pogoda p { font-size: 1rem; }
    @media (min-width: 1200px) { #pogoda p { font-size: 1.2rem; } }

    #pogoda .temp { font-size: 2rem; }
    @media (min-width: 1000px) { #pogoda .temp { font-size: 5vw; } }
    @media (min-width: 1920px) { #pogoda .temp { font-size: 8rem; } }

    #pogoda .desc { font-size: 1.2rem; }
    @media (min-width: 1100px) { #pogoda .desc { font-size: 1.6rem; } }

    #pogoda .wind { font-size: 1.2rem; }
    @media (min-width: 1300px) { #pogoda .wind { font-size: 1.4rem; } }

    #prawy {
        display: flex;
        align-items: center;
        justify-content: center;
        height: calc(100vh - 4.5vh);
        background: white;
        padding: 0;
        margin: 0;
        flex: 0 0 auto;
    }

    #prawy img {
        height: 100%;
        width: auto;
        max-width: none;
        object-fit: contain;
        display: block;
    }

    #map,
    .leaflet-container { width: 100%; height: 100%; }

    /* TAM ZMIENIAJ W DRUGIM FONT SIZE ŻEBY ZMIENIĆ ROZMIAR CZCIONKI W TABELI */
    th, td { font-size: 0.9rem; }
    @media (min-width: 1200px) { th, td { font-size: 1.2rem; } }

    th:first-child, td:first-child {
        width: 3rem;
        padding: 0;
    }

    @media (max-width: 1024px) {
        #godzina { font-size: 2rem; margin-bottom: 0.625rem; }

        #pogoda img   { width: 3.5rem; }
        #pogoda .temp { font-size: 2rem; }
        #pogoda .desc,
        #pogoda .wind { font-size: 1rem; }

        th:first-child, td:first-child { width: 2rem; }

        td {
            padding: 0.5rem;
            font-size: 0.85rem;
            height: 0.3rem;
            word-wrap: break-word;
            white-space: normal;
            overflow-wrap: break-word;
        }

        .stop-icon { width: 2rem; }
    }

    @media (max-width: 1024px) {
        #srodek {
            display: flex !important;
            flex-direction: column;
            order: -1;
            width: 100%;
            flex: 0 0 auto;
            align-items: center;
            justify-content: space-between;
            margin: 0.625rem 0;
            padding: 0.75rem 1rem;
            min-height: 120px;
            overflow: visible;
            position: relative;
            z-index: 0;
        }

        #godzina { min-height: 2.2rem; border-bottom: 0; }
        #pogoda  { min-height: 2.2rem; gap: 1rem; }
        #wind, #desc, #temp{
            padding: 0 1rem;
        }
    }

    /*GDYBY W PRZYSZŁOŚCI NIE DZIAŁAŁO POLE DO QR W MNIEJSZYCH ROZDZIELCZOŚCIACH TO NARPAWIĆ TO MIN-WIDTH: 2048PX, W CHROME 75 SKALOWANIE W DÓŁ ZMIENIA ROZDZIELCZOŚĆ,
    A W NAJNOWSZYM JUŻ NIE, CZERWONE POLE POD QR POJAWIA SIĘ TYLKO W WYŻSZEJ ROZDZIELCZOŚCI
     */

    /* 2K+ */
@media (min-width: 2048px) {

        th, td { font-size: 2.7rem; }
        td { padding: 1.2rem 1.4rem; }
        .stop-icon { width: 5rem; }

        #pogoda .temp { font-size: 10rem; }
        #pogoda .desc { font-size: 3rem; }
        #pogoda .wind { font-size: 3rem; }

        header .logo { height: 7rem; }

    header h1 {
        margin: 0;
        font-size: 3rem;
        font-weight: 600;
        text-align: center;
    }

    /* pogoda z QR */
    #pogoda {
        display: flex;
        flex-direction: column;      /* pogoda u góry i QR pod spodem */
        align-items: center;
        gap: 1rem;
    }

    /* KARTA QR */
    .qr-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        background: #820e20;
        border-radius: 16px;
        padding: 0.3rem 0.75rem 0.9rem 0.75rem;
        box-shadow: 0 6px 16px rgba(0,0,0,0.15);
        color: #fff;
        /* QR będzie miał 100% poniższej szerokości */
        width: 230px;
        margin-top: 10rem;
    }

    /* sam obraz QR */
    .qr-card .qr-image {
        display: block;
        width: 100%;
        height: auto;
        border-radius: 10px;
    }

    /* napis pod QR */
    .qr-card .qr-text {
        display: block;
        width: 100%;
        text-align: center;
        margin-top: 0.1rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        font-size: 1rem;
    }

    @media (min-width: 1920px) {
        .qr-card       { width: 270px; }
        .qr-card .qr-text { font-size: 1.15rem; }
    }
    /* 2K+ dodatkowy scale (pasuje do Twojego fallbacku) */
    @media (min-width: 2048px) {
        .qr-card       { width: 340px; }
        .qr-card .qr-text { font-size: 1.25rem; }
    }
    @media (min-width: 3840px) {
        .qr-card       { width: 400px; }
        .qr-card .qr-text { font-size: 1.6rem; }
    }
}}