* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 30px 20px;
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    color: #222;
}

.logo-tura {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 100px;
    height: auto;
    z-index: 10;
}

.container {
    max-width: 1450px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin: 0 0 20px;
    font-size: 32px;
}

.dugmici-linkovi {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.glavni-link {
    display: block;
    width: max-content;
    margin: 0 auto 15px;
    padding: 9px 16px;
    background: #333;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
}

.glavni-link:hover {
    background: #111;
}

.rezultati-link {
    display: block;
    width: max-content;
    margin: 0 auto 25px;
    padding: 10px 18px;
    background: #333;
    color: white;
    text-decoration: none;
    border-radius: 6px;
}

.rezultati-link:hover {
    background: #111;
}

.zaglavlje {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ime-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.ime-wrapper label {
    font-weight: bold;
}

#imeResavaca {
    width: 280px;
    padding: 11px 12px;
    font-size: 16px;
    border: 1px solid #aaa;
    border-radius: 6px;
}

#kodTakmicara {
    width: 280px;
    padding: 11px 12px;
    font-size: 16px;
    border: 1px solid #aaa;
    border-radius: 6px;
    text-transform: uppercase;
}

#registracijaBtn,
#prijavaBtn {
    padding: 11px 20px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    background: #333;
    color: white;
    cursor: pointer;
    margin-left: 5px;
}

#registracijaBtn:hover,
#prijavaBtn:hover {
    background: #111;
}

#porukaTakmicar {
    margin-top: 12px;
    font-weight: bold;
}

#kodPrikaz {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
    text-align: center;
}

#generisaniKod {
    display: block;
    margin: 8px 0;
    font-size: 24px;
    letter-spacing: 3px;
}

#takmicarPrijavljen {
    margin-top: 15px;
    font-size: 18px;
}

#startBtn {
    padding: 11px 20px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    background: #333;
    color: white;
    cursor: pointer;
}

#startBtn:hover:not(:disabled) {
    background: #111;
}

#startBtn:disabled {
    opacity: 0.5;
    cursor: default;
}

.tabela {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}


/* =========================================================
   GLAVNI RED ANAGRAMA
   ========================================================= */

.red {
    display: grid;
    grid-template-columns:
        50px
        minmax(140px, 1.3fr)
        90px
        100px
        minmax(160px, 1.5fr)
        100px
        minmax(300px, 1.7fr);

    align-items: center;

    gap: 15px;

    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
}

.red:last-child {
    border-bottom: none;
}

.zaglavlje-red {
    font-weight: bold;
    background: #eaeaea;
}


/*
   Kada se PRVA 3 REŠAVAČA ne prikazuju,
   red ima samo 6 kolona.
*/

.tabela.bez-top3 .red {
    grid-template-columns:
        50px
        minmax(140px, 1.3fr)
        90px
        100px
        minmax(160px, 1.5fr)
        100px;
}

.tabela.bez-top3 .zaglavlje-red > div:last-child {
    display: none;
}


.broj {
    text-align: center;
    font-weight: bold;
}

.anagram {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
}

.kljuc,
.broj-slova {
    text-align: center;
    font-weight: bold;
}

.resenje-input {
    width: 100%;
    padding: 9px 10px;
    font-size: 16px;
    border: 1px solid #aaa;
    border-radius: 6px;
}

.resenje-input:disabled {
    background: #eee;
    cursor: not-allowed;
}

.resenje-input.tacno {
    background: #d9f7df;
    border-color: #28a745;
}

.resenje-input.netacno {
    background: #ffdede;
    border-color: #dc3545;
}

.proveri-btn {
    padding: 9px 10px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    background: #555;
    color: white;
    cursor: pointer;
}

.proveri-btn:hover:not(:disabled) {
    background: #333;
}

.proveri-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.poruka {
    text-align: center;
    margin: 20px 0;
    min-height: 22px;
    font-weight: bold;
}


/* =========================================================
   TABELA PRVA TRI REŠAVAČA
   ========================================================= */

.top3 {
    width: 100%;
    min-width: 0;
}

.top3-naslov {
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
    color: #444;
}

.top3-tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #fafafa;
}

.top3-tabela th,
.top3-tabela td {
    border: 1px solid #d5d5d5;
    padding: 4px 6px;
    text-align: left;
}

.top3-tabela th {
    background: #eaeaea;
    font-weight: bold;
    white-space: nowrap;
}

.top3-tabela th:first-child,
.top3-tabela td:first-child {
    width: 35px;
    text-align: center;
}

.top3-tabela th:last-child,
.top3-tabela td:last-child {
    white-space: nowrap;
}

.top3-prazno {
    text-align: center;
    color: #777;
    font-style: italic;
    padding: 7px;
    background: #fafafa;
    border: 1px solid #ddd;
    font-size: 12px;
}

.top3-ucitavanje {
    text-align: center;
    color: #777;
    font-size: 12px;
    padding: 7px;
}

.mesto-prvo {
    font-weight: bold;
}

.mesto-drugo {
    font-weight: bold;
}

.mesto-trece {
    font-weight: bold;
}


/* =========================================================
   SUŽENI PRIKAZ - RAČUNAR, TABLET I MOBILNI
   ========================================================= */

@media (max-width: 1100px) {

    .container {
        max-width: 100%;
    }


    /*
       Dugmad se pomeraju udesno da ne budu
       ispod loga Tura.
    */

    .dugmici-linkovi {
        padding-left: 110px;
    }


    /*
       3 kolone:

       1. broj anagrama
       2. glavni sadržaj
       3. desni deo
    */

    .red {
        display: grid;

        grid-template-columns:
            40px
            minmax(0, 1fr)
            auto;

        gap: 8px 10px;

        padding: 12px 15px;
    }


    /*
       Zaglavlje kolona se na suženom prikazu
       ne prikazuje.
    */

    .zaglavlje-red {
        display: none;
    }


    /* =====================================================
       1. RED - BROJ + ANAGRAM
       ===================================================== */

    .broj {
        display: block;

        grid-column: 1;
        grid-row: 1;

        text-align: center;
        font-weight: bold;
    }

    .anagram {
        grid-column: 2 / 4;
        grid-row: 1;

        font-size: 20px;

        min-width: 0;
        overflow-wrap: break-word;
    }


    /* =====================================================
       2. RED - KLJUČ | VREDNOST
       ===================================================== */

    .kljuc {
        display: block;

        grid-column: 2;
        grid-row: 2;

        text-align: left;
        white-space: nowrap;
    }

    .broj-slova {
        display: block;

        grid-column: 3;
        grid-row: 2;

        text-align: right;
        white-space: nowrap;
    }


    /* =====================================================
       3. RED - REŠENJE | PROVERI
       ===================================================== */

.resenje-input {
    grid-column: 1 / 3;
    grid-row: 3;

    width: calc(100% - 5px);
    min-width: 0;
}

.proveri-btn {
    grid-column: 3;
    grid-row: 3;

    white-space: nowrap;
    margin-left: 2px;
}

    /* =====================================================
       4. RED - PRVA TRI REŠAVAČA
       ===================================================== */

    .top3 {
        grid-column: 1 / 4;
        grid-row: 4;

        width: 100%;
        min-width: 0;

        margin-top: 4px;
    }


    /*
       VAŽNO:
       Kada PRVA 3 REŠAVAČA nisu uključena,
       desktop pravilo .tabela.bez-top3 .red
       je specifičnije od .red.

       Zato ovde eksplicitno vraćamo
       responsive raspored od 3 kolone.
    */

    .tabela.bez-top3 .red {
        grid-template-columns:
            40px
            minmax(0, 1fr)
            auto;

        grid-template-rows:
            auto
            auto
            auto;

        grid-auto-rows: 0;
    }
}


/* =========================================================
   TELEFON
   ========================================================= */

@media (max-width: 600px) {

    .logo-tura {
        width: 70px;
        top: 8px;
        left: 8px;
    }

    .dugmici-linkovi {
        padding-left: 80px;
    }
}


/* =========================================================
   IZBOR IGARA
   ========================================================= */

#igrePanel {
    display: none;
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#igrePanel h2 {
    margin: 0 0 15px;
    text-align: center;
    font-size: 22px;
}

.igre-grupa {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.igra-polje {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.igra-polje label {
    font-weight: bold;
    font-size: 14px;
}

.igra-polje select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #aaa;
    border-radius: 6px;
    background: white;
}

#sacuvajIgreBtn {
    display: block;
    margin: 18px auto 0;
    padding: 11px 22px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    background: #333;
    color: white;
    cursor: pointer;
}

#sacuvajIgreBtn:hover:not(:disabled) {
    background: #111;
}

#sacuvajIgreBtn:disabled {
    opacity: 0.5;
    cursor: default;
}

#porukaIgre {
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
    font-weight: bold;
}

@media (max-width: 800px) {

    .igre-grupa,
    .najlepsi-sekcija .igre-grupa {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {

    .igre-grupa,
    .najlepsi-sekcija .igre-grupa {
        grid-template-columns: 1fr;
    }
}

/* =========================
   OZNAKE IGARA
   ========================= */

.broj {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}


.oznake-igre {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
}


.oznaka-igre {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
    white-space: nowrap;
}

.tura-vreme-info {
    margin: 10px 0 18px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f4f6f8;
    font-weight: 600;
    text-align: center;
}

.igre-sekcija {
    margin: 14px 0;
    padding: 14px;
    border-radius: 10px;
}

.bonus-sekcija {
    border: 2px solid #d6b85c;
    background: #fffaf0;
}

.najlepsi-sekcija {
    border: 1px solid #d9dde2;
    background: #fafbfc;
}

.najlepsi-sekcija .igre-grupa {
    grid-template-columns: repeat(3, 1fr);
}

.igre-sekcija h3 {
    margin: 0 0 12px;
}

.igra-polje select.izbor-sacuvan {
    background: #dff3e4;
    border-color: #5a9f69;
}

.igre-sekcija select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Najlepši anagrami: na užem ekranu sva tri idu jedan ispod drugog.
   Ovo pravilo je namerno posle desktop definicije sa 3 kolone. */
@media (max-width: 800px) {
    .najlepsi-sekcija .igre-grupa {
        grid-template-columns: 1fr;
    }
}

/* Najlepši – ista plava boja,
   različite nijanse */

.np-3 {
    background: #1f5f99;
    color: white;
}


.np-2 {
    background: #4d86bd;
    color: white;
}


.np-1 {
    background: #8fb5d8;
    color: #17324d;
}


/* Bonus */

.bp {
    background: #f2c94c;
    color: #4a3b00;
}


.red.anagram-resen .anagram,
.red.anagram-resen .kljuc,
.red.anagram-resen .broj-slova {
    color: #aaa;
}

.admin-panel {
    margin-top: 40px;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 10px;
}

.admin-naslov {
    font-weight: bold;
    margin-bottom: 10px;
}

.admin-red {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-red input {
    padding: 10px;
    flex: 1;
    max-width: 350px;
}

.admin-red button {
    padding: 10px 16px;
}

.admin-poruka {
    margin-top: 10px;
    font-weight: bold;
}

@media (max-width: 600px) {

    .admin-red {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-red input {
        max-width: none;
    }

}
/* =========================================================
   IZBOR PISMA
========================================================= */
.pismo-prekidac {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 10px 0 18px;
}

.pismo-dugme {
    width: auto;
    min-width: 105px;
    padding: 8px 14px;
    border: 1px solid #b9b9b9;
    border-radius: 999px;
    background: #f4f4f4;
    color: #333;
    font-weight: 700;
    cursor: pointer;
}

.pismo-dugme.aktivno {
    background: #2f7d32;
    border-color: #2f7d32;
    color: #fff;
}

@media (max-width: 480px) {
    .pismo-prekidac {
        gap: 6px;
    }

    .pismo-dugme {
        min-width: 0;
        flex: 1 1 0;
        max-width: 150px;
    }
}
