* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f4f7f6;
    padding-top: 70px;
}

header {
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: darkgoldenrod;
    text-decoration: none;
    letter-spacing: 1px;
}

nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

header a, header button {
    text-decoration: none;
    color: #2d3436;
    font-weight: 600;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 20px;

    transition: all 0.3s ease-in-out;
}

header button {
    border: none;
    background-color: white;
    cursor: pointer;
}

header a:hover, header button:hover {
    background-color: #f0eaff;
    color: #cdb55c;
}

.form_login {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 40px;
    gap: 20px;
    width: 100%;
    max-width: 400px;
}

main {
    display: flex;
    flex-direction: row;
    margin: 40px auto;
    gap: 40px;
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
}

.amici_left {
    flex-grow: 1;
}

#aggiungi_amico {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

main.centered {
    align-items: center;
    justify-content: center;
    min-height: 69vh;
    flex-direction: column;
}

.form_login label {
    font-weight: 800;
    text-align: center;
    font-size: 28px;
    color: #2d3436;
    margin-bottom: 10px;
}

input {
    padding: 5px;
}

.form_login input {
    padding: 12px 15px;
    border: 1px solid #a1a4b3;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

.form_login input:focus {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.form_login > button {
    background-color: #698ad8;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    margin-top: 10px;
}

.form_login > button:hover {
    background-color: #5d77e6;
}

.errore {
    color: red;
    text-align: center;
}

.lista_bella {
    width: 100%;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.lista_bella td {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
}

.lista_bella tbody tr:nth-child(odd) {
    background-color: white;
}

.lista_bella tbody tr:nth-child(even) {
    background-color: rgba(124, 199, 255, 0.49);
}

.lista_bella tbody tr {
    transition: background-color 0.2s ease;
}

.lista_bella tbody tr:nth-child(odd):hover {
    background-color: #f0f0f0;
}

.lista_bella tbody tr:nth-child(even):hover {
    background-color: rgba(124, 199, 255, 0.75);
}

.lista_bella td, .lista_bella th {
    padding: 12px 15px;
}

.lista_bella thead {
    background-color: #7cc7ff;
    font-weight: bolder;
}

#accetta_richieste {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#accetta_richieste > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f4f7f6;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #dcdde1;
}

.pulsante_accetta {
    background-color: #0984e3;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    margin: 0;
}

#sfida_amici {
    width: 50%;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

#sfida_amici td {
    text-align: center;
}

#sfida_amici tbody tr {
    transition: background-color 0.2s ease;
    background-color: white;
}

#sfida_amici tbody tr:hover {
    background-color: #f0f0f0;
}

#sfida_amici td, #sfida_amici th {
    padding: 12px 15px;
}

#sfida_amici thead {
    background-color: #7cc7ff;
    font-weight: bolder;
}

.pulsante_accetta.disabilitato {
    background-color: #7a9ebd;
    cursor: not-allowed;
}

#gioco {
    display: none;
    margin: 40px auto;
    justify-content: center;
    flex-direction: row;
    width: 100%;
    max-height: 100%;
    flex-grow: 1;
    align-items: stretch;
    gap: 20px;
}

#accetta_sfide {
    display: none;
    font-size: 30px;
}

#sfide {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);

    display: flex;
    position: fixed;
    top: 70px;
    right: 30rem;
    background-color: white;
    padding: 50px 10px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    z-index: 999;
    min-width: 250px;
    border: 1px solid #dcdde1;
    height: 200px;
    text-align: center;
    transition: all 0.3s ease-in-out;
    overflow: auto;
    flex-direction: column;
    gap: 10px;
}

#sfide > div {
    display: flex;
    flex-direction: column;
    gap: 7px;
    border: 1px solid #dcdde1;
    border-radius: 30px;
    padding: 5px;
}

#sfide.aperto {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#accetta_sfide.scuro {
    background-color: #efefef;
}

#attesa {
    display: none;
    margin: 40px auto;
    max-width: 1200px;
    align-items: center;
    justify-content: center;
    min-height: 69vh;
    font-weight: bolder;
    font-size: 80px;
    text-align: center;
    animation: pulsazione 1.8s infinite ease-in-out;
}

@keyframes pulsazione {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

#tabellone {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 10px;
    max-width: 60%;
    background-color: #1e3799;
    padding: 20px;
    border-radius: 20px;
    flex: 2;
    align-self: center;
}

#tabellone > .foro {
    border: none;
    border-radius: 50%;
    aspect-ratio: 1/1;
    background-color: #f4f7f6;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.gettone {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.gettone.rosso {
    background: linear-gradient(135deg, #ff4d4d, #d63031);
    opacity: 1;
}

.gettone.giallo {
    background: linear-gradient(135deg, #ffe066, #f5cd23);
    opacity: 1;
}

.gettone.caduta {
    animation: cadi_e_rimbalza 0.8s ease-in forwards;
}

@keyframes cadi_e_rimbalza {
    0% {
        transform: translateY(-800px);
    }
    75% {
        transform: translateY(0);
    }
    88% {
        transform: translateY(-15px);
    }
    100% {
        transform: translateY(0);
    }
}

#main_gioco {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    height: calc(100vh - 120px);
    margin-top: 0;
}

#messaggio_fine {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
    font-weight: 800;
    font-size: 28px;
    color: #2d3436;
    gap: 20px;
    border: 3px solid #3d5dc6;
    position: absolute;
    top: 30%;
    opacity: 0;
    pointer-events: none;
    transition: all 0.8s ease-out;
}

#messaggio_fine.visualizza {
    opacity: 0.7;
    pointer-events: auto;
}

#messaggio_fine a {
    background-color: #0984e3;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    display: inline-block;
}

#messaggio_fine a:hover {
    background-color: #74b9ff;
}

#destra {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 280px;
    max-width: 400px;
    align-items: stretch;
    width: 30%;
    flex: 1;
}

#turno {
    display: none;
    background-color: white;
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    font-size: 22px;
    text-align: center;
    color: #2d3436;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#chat {
    flex-grow: 1;
    background-color: white;
    border-radius: 20px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08);
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

.bold {
    font-weight: 800;
}

#messaggi {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    padding-right: 5px;
}

#messaggi > div {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

#input_chat {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

#chat_input {
    flex-grow: 1;
    padding: 12px 15px;
    border-radius: 20px;
    border: 1px solid #dcdde1;
    outline: none;
}

#chat_send {
    padding: 10px 20px;
    border-radius: 20px;
    background-color: #0984e3;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.messaggio {
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 80%;
    width: fit-content;
    font-size: 15px;
}

.mio.messaggio {
    background-color: #0984e3;
    color: white;
    align-self: flex-end;
}

.altro.messaggio {
    background-color: #f1f2f6;
    color: #2d3436;
    align-self: flex-start;
}

.messaggio.sistema {
    background-color: #e2e8f0;
    color: #475569;
    align-self: center;
    font-style: italic;
    font-size: 13px;
    text-align: center;
    border: 1px dashed #cbd5e1;
}

main#index {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('/images/sfondo.gif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    width: 100%;
    max-width: 100%;
    margin: 0;
    height: calc(100vh - 70px); 
    
    text-align: center;
    color: white;
    padding: 20px;
}

main#index > h1 {
    font-size: 80px;
    font-weight: 900;
    color: darkgoldenrod;
    margin-bottom: 15px;
}

main#index > p {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 50px;
    color: #f1f2f6;
}

#pulsanti_index {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

#pulsanti_index > a {
    padding: 16px 40px;
    border-radius: 35px;
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
}

#pulsante_index_online {
    background-color: #0984e3;
    color: white;
    border: 2px solid #0984e3;
}

#pulsante_index_online:hover {
    background-color: #56acff;
    border-color: #56acff;
}

#pulsante_index_offline {
    color: white;
    border: 2px solid white;
}

#pulsante_index_offline:hover {
    background-color: white;
    color: #2d3436;
}

#main_leader {
    justify-content: center;
}

#classifica {
    width: 50%;
}

img {
    width: auto;
    height: 1em;
}

table img {
    height: 1.5em;
}

#lista_amici a {
    cursor: pointer;
}

#chat.privata {
    height: calc(100vh - 150px);
}

#regole {
    font-weight: 400;
    font-size: 25px;
}

#regole ol, #regole ul {
    margin-left: 50px;
}

#regole {
    background-color: white;
    border-radius: 15px;
    border: 1px solid #bdbdbd;
    padding: 40px 50px;
    max-width: 800px;
    width: 100%;
    line-height: 1.6;
}

#regole h1 {
    color: darkgoldenrod;
    text-align: center;
    font-size: 36px;
    margin-bottom: 20px;
    padding-bottom: 15px;
}

#regole h2 {
    color: #2a8fda;
    font-size: 24px;
    margin-top: 30px;
    margin-bottom: 15px;
}

#regole p, #regole ul, #regole ol {
    font-size: 18px;
}

#regole ul, #regole ol {
    margin-left: 25px;
    margin-bottom: 20px;
}

#regole li {
    margin-bottom: 10px;
}

#main_leader tr.tu td{
    color: #3b4385;
    font-weight: 800;
}

#main_profilo {
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid #d5d5d5;
    border-radius: 20px;
    padding: 40px;
    width: fit-content;
    align-items: flex-start;
    margin: 40px auto;
    background-color: white;
    min-width: 500px;
}

#main_profilo h1 {
    color: darkgoldenrod;
    font-size: 36px;
    margin: 0;
}

#main_profilo p {
    font-size: 20px;
    color: #2d3436;
    margin: 0;
}

#cambia_password {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 10px;
    border-top: 1px solid #dcdada;
    padding-top: 20px;
}

#cambia_password label {
    font-weight: bold;
    font-size: large;
    color: #2d3436;
}

#cambia_password input {
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

#cambia_password input:focus {
    border-color: #2a8fda;
}

#cambia_password button {
    text-decoration: none;
    padding: 12px;
    font-size: 18px;
    font-weight: bold;
    background-color: #2a8fda;
    color: white;
    border-radius: 20px;

    border: 1px solid #2a8fda;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 5px;
}

#cambia_password button:hover {
    background-color: #2275b3;
}