
:root {
    --header-height: min(10vh, 80px);
    --footer-height: min(15vh, 100px);
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-height: 100vh;
    font-size: 16px;
    overflow: hidden; 
    position: fixed; 
    width: 100%;
    height: 100%;
}

header {
    background-color: lightblue;
    min-height: var(--header-height);
    padding: 10px;
}

main {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0; 
    padding: 0; 
}

section {
    padding: 15px;
    border-radius: 0; 
}

#lewy, #prawy {
    background-color: lightblue;
    min-height: 200px;
}

#lewy {
    background-color: lightblue;
    min-height: 200px;
    position: relative;
    background-image: url('crab-svgrepo-com.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-blend-mode: soft-light;
}

#prawy {
    background-color: lightblue;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

#srodkowy {
    background-color: lightcoral;
    min-height: 250px;
    order: -1; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding-top: 20px;
}

#srodkowy img {
    position: absolute;
    width: 150px;
    height: auto;
    opacity: 0.3;
    z-index: 1;
    pointer-events: none;
    margin-bottom: 5px;
}

footer {
    padding: 15px;
    height: auto;
    min-height: var(--footer-height);
    transition: background-color 0.3s;
}

.bi {
    font-size: 2rem; 
}

.btn-primary {
    background-color: lightgreen;
    border: 2px solid black;
    font-size: clamp(1rem, 4vw, 1.5rem);
    padding: 12px 20px;
    min-height: 44px;
    width: 100%;
    max-width: 300px;
    margin: 10px 0;
    border-radius: 8px;
}

#random-numbers {
    font-size: clamp(2rem, 8vw, 3rem);
    text-align: center;
    padding: 20px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 2;
}

#score {
    text-align: center;
    font-size: clamp(1.5rem, 5vw, 2rem);
    margin: 10px 0;
}

#number-input, #nickname-input, #restart-nickname {
    width: 100%;
    max-width: 300px;
    font-size: clamp(1rem, 4vw, 1.5rem);
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #ccc;
    border-radius: 8px;
    min-height: 44px;
}

#nickname-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

#leaderboard {
    margin-top: 20px;
}

#leaderboard div {
    margin-bottom: 10px;
}

#message-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    display: none;
    z-index: 1000;
    text-align: center;
    font-size: 1.5rem;
}

.icon-score {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    margin: 5px 0;
    border-radius: 5px;
    font-size: clamp(0.875rem, 3vw, 1.25rem);
    position: relative;
    z-index: 1; 
}

.icon-score i {
    margin-right: 10px;
}

.icon-score span {
    flex-grow: 1;
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.8); 
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 80%; 
    max-width: 500px;
    text-align: center;
    border-radius: 5px;
}

.modal-content h2 {
    color: #ff0000;
    margin-bottom: 20px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    text-align: center;
    z-index: 9999;
}

.cookie-buttons {
    margin-top: 10px;
}

.cookie-buttons button {
    margin: 0 10px;
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#acceptCookies {
    background-color: #4CAF50;
    color: white;
}

#rejectCookies {
    background-color: #f44336;
    color: white;
}


@media screen and (min-width: 768px) {
    main {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0; 
    }

    #srodkowy {
        order: 0;
        flex: 100%;
    }

    #lewy, #prawy {
        flex: 1;
        min-width: 250px;
    }

    footer form {
        display: flex;
        gap: 10px;
        justify-content: center;
        align-items: center;
    }

    #number-input {
        width: auto;
        flex: 0 1 300px;
    }
}

@media screen and (min-width: 1024px) {
    main {
        flex-wrap: nowrap;
        gap: 0; 
    }

    #srodkowy {
        flex: 3;
    }

    #lewy, #prawy {
        flex: 1;
    }

    .modal-content {
        max-width: 500px;
        padding: 30px;
    }
}


@media screen and (max-width: 360px) {
    body {
        font-size: 14px;
    }

    .btn-primary {
        padding: 8px 16px;
    }

    #random-numbers {
        font-size: 1.75rem;
    }
}


@media screen and (max-width: 767px) {
    main {
        flex-direction: column;
        height: calc(100vh - var(--header-height)); 
        overflow-y: auto; 
        background-color: lightblue; 
    }

    #lewy {
        order: 1; 
        min-height: auto; 
        flex-shrink: 0; 
        margin: 0;
        padding: 10px;
        background-color: lightblue;
    }

    #srodkowy {
        order: 2; 
        min-height: auto; 
        margin-bottom: 20px;
        flex-shrink: 0; 
        margin: 0;
        padding: 10px;
        
    }

    #prawy {
        order: 4;
        min-height: auto; 
        height: auto; 
        flex-shrink: 0; 
        margin: 0;
        padding: 10px;
        background-color: lightblue;
        margin-bottom: 80px; 
    }

    #number-form {
        order: 3; 
        position: static;
        padding: 10px;
        margin-bottom: 80px; 
        display: flex !important; 
        flex-direction: column;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
        flex-shrink: 0; 
        visibility: visible;
        opacity: 1;
        z-index: 90;
    }

    #number-form[style*="display: none"] {
        display: none !important;
    }

    #number-form[style*="display: flex"] {
        display: flex !important;
    }

    footer {
        
        clear: both;
    }

    #nickname-form {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: lightblue;
        padding: 10px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 100;
        margin-bottom: 0;
    }
}


@media screen and (min-width: 768px) {
    footer {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: lightblue;
    }

    #number-form {
        max-width: 800px;
        margin: 0 auto;
        display: flex;
        gap: 10px;
        justify-content: center;
        align-items: center;
        padding: 10px;
    }

    #number-input {
        width: auto;
        flex: 0 1 300px;
    }

    main {
        margin-bottom: var(--footer-height); 
    }

    #prawy #number-form {
        display: none;
    }
}


@media screen and (min-width: 768px) {
    #prawy {
        position: static;
        margin-bottom: 0;
    }

    footer {
        margin-bottom: 0;
    }
}


@media screen and (min-width: 1024px) {
    
}