@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700&display=swap');



/* Personaliza a barra de rolagem inteira */
::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

/* Personaliza o fundo da barra de rolagem */
::-webkit-scrollbar-track {
    background: white;
    border-radius: 5px;
}

/* Personaliza a barra de rolagem em si */
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.219);
    border: 2px solid white;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);

}

.hidden {
    display: none;
}


body {
    height: 100vh;
    -webkit-user-select: none;
    /* Chrome, Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE */
    user-select: none;
    /* Standard */

    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Titillium Web", sans-serif;

}

#game {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    padding-top: 0;
    box-sizing: border-box;
}

#target-color {
    border-radius: 10px 0 0 10px;
    border: 2px solid black;
    border-right: 0;
}

#paint-area {
    border-radius: 0 10px 10px 0;
    border: 2px solid black;
    border-left: 0;
}

#target-color,
#paint-area {
    width: 100%;
    height: 200px;
    margin-bottom: 10px;
}


#target-color {
    background-color: #fff;
}

#paint-area {
    background-color: #fff;
}


.slider {
    width: 100%;
    margin-bottom: 0px;
}

#progress p {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 0px;
    font-size: large;
    font-weight: bold;
    margin-bottom: 0;
}

.doisblocos_cores {
    display: flex;
    margin-top: 30px;

}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 13px;
    border-radius: 5px;
    outline: none;
    border: 2px solid black;
    box-sizing: border-box;
}

/* Estilização do "thumb" do slider */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 30px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid black;
}

/* Estilização no Firefox */
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
}

.slider-container label {
    font-size: small;
}

.slider-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 10px;

}

.slider-container:last-of-type {
    margin-bottom: 0;
}

#color-list {
    margin-top: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-start;
    width: 100%;
    height: 100%;

    list-style-type: none;
    padding: 0;
    text-wrap: wrap;
    max-height: 105px;
    height: fit-content;
    overflow-y: auto;
}

#color-list li {
    text-wrap: nowrap;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid black;
    text-transform: uppercase;
    text-align: center;
    box-sizing: border-box;
    min-width: 90px;
    max-width: 120px;
    flex: 1;
    height: fit-content;
    cursor: pointer;
}

.sliderselista {
    display: flex;
    flex-direction: column;
}

.botoesefooter {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.botoesefooter div {
    display: flex;
    gap: 10px;
}

.botoesefooter button {
    height: fit-content;
    padding: 5px 30px;
    font-size: 1rem;

}

/* start game -----------------------------------------------------------------------------------------------------------------------------------------------------*/

.logohuebind {
    margin: 20px;
    margin-top: 40px;
}

footer {
margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #d0d0db;
    text-align: center;
}

#start-screen {
    width: 100%;
    width: fit-content;
    padding: 20px;
    padding-top: 0;
    box-sizing: border-box;
    text-align: center;
    background-color: white;
    border-radius: 10px;
    border: 2px solid black;
}

.start-screen-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

#start-screen h1 {
    font-size: 2.5rem;
    color: black;
    margin-bottom: 15px;
}

button {
    font-family: "Titillium Web", sans-serif;
    border: 2px solid black;
    color: black;
    animation: changeBackgroundColor 20s infinite;
    /* Animação quando passar o mouse */
    padding: 15px 20px;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-weight: bold;
}

button:hover {
    animation: changeBackgroundColor 5s infinite;
    /* Animação quando passar o mouse */

}

button:focus {
    outline: none;
    /* Remove o contorno padrão do foco */
}


/* Define a animação para a mudança de cor do fundo */
@keyframes changeBackgroundColor {
    0% {
        background-color: hsl(0, 100%, 80%);
    }

    14.29% {
        background-color: hsl(60, 100%, 80%);
    }

    28.57% {
        background-color: hsl(300, 100%, 80%);
    }

    42.86% {
        background-color: hsl(360, 100%, 80%);
    }

    57.14% {
        background-color: hsl(120, 100%, 80%);
    }

    71.43% {
        background-color: hsl(180, 100%, 80%);
    }

    85.71% {
        background-color: hsl(240, 100%, 80%);
    }

    100% {
        background-color: hsl(0, 100%, 80%);
        /* Volta ao vermelho */
    }
}

/* Aplica a animação ao body quando o start-screen estiver visível */
body.change-bg {
    animation: changeBackgroundColor 20s infinite;
    /* Duração de 10s, com repetição infinita */
}

/* media ----------------------------------------------------------------------------------------------------------------------------------------------- */

@media (max-height: 500px) {

    #start-screen {

        border-top: none;
    }


    #start-screen {
        border-radius: 0 0 10px 10px;
    }

    body {
        height: fit-content;
    }

    #target-color,
    #paint-area {
        height: 150px;
    }

    #color-list {
        flex-direction: column;
        margin-top: 22px;
        flex-wrap: nowrap;
        height: 105px;
        width: 100%;

        overflow-y: visible;
        overflow-x: hidden;
        justify-content: flex-start;
        box-sizing: border-box;

    }

    /* Personaliza a barra de rolagem em si */
    #color-list::-webkit-scrollbar-thumb {
        background: white;
    }

    #color-list::-webkit-scrollbar-thumb:hover {
        background: white;
    }

    /* Personaliza a barra de rolagem inteira */
    #color-list::-webkit-scrollbar {
        height: 0px;
        width: 0px;
    }

    #color-list li {
        align-content: center;
    }

    #sliders-container {
        display: flex;
        flex-direction: column;
        flex: 1;
    }

    .sliderselista {
        flex-direction: row;
        gap: 20px;
    }

    #target-color {
        border-radius: 0 0 0 10px;
        border: 2px solid black;
        border-right: 0;
        border-top: 0;
    }

    #paint-area {
        border-radius: 0 0 10px 0;
        border: 2px solid black;
        border-left: 0;
        border-top: 0;
    }

    .doisblocos_cores {
        margin-top: 0px;
    }
}

/* ----------------------------------------------------------------------------------------------------------*/


/* Botão no canto superior direito */
#info-button,
#leaderboard-button {
    position: fixed;
    top: 20px;
    padding: 10px 22px;
    background-color: white;
    color: black;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid black;
    z-index: 2;
}

#info-button {
    right: 95px;
}

#leaderboard-button {
    right: 20px;
}

/* Painel de informações no lado esquerdo */
#info-panel {
    position: fixed;
    top: 20px;
    right: -300px;
    /* Inicialmente escondido */
    width: fit-content;
    height: fit-content;
    animation: changeBackgroundColor 20s infinite;
    border: 2px solid black;
    padding: 10px 15px;
    border-radius: 5px;
    transition: right 0.3s ease, opacity 0.1s ease;
    /* Transições suaves */
    opacity: 0;
    /* Invisível inicialmente */
    pointer-events: none;
    /* Evita interações enquanto invisível */
    z-index: 1;
}

/* Painel visível */
#info-panel.open {
    right: 160px;
    /* Posição final ao abrir */
    opacity: 1;
    /* Torna visível */
    pointer-events: auto;
    /* Permite interações */
    transition: opacity 0.12s ease;
    /* Transições suaves */
}

#info-panel a {
    font-weight: bold;
    text-decoration: none;
    color: black;
}

/* ========================================= */
/* ESTILOS DO LEADERBOARD - Inspirado no Seja Veloz */
/* ========================================= */

/* Popup principal */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    padding: 15px;
    padding-right: 3px;
    z-index: 96;
    margin: 0;
    box-sizing: border-box;
    overflow-y: scroll;
    font-family: "Titillium Web", sans-serif;
    background-color: white;
}

input {
    font-family: "Titillium Web", sans-serif;
}

.popup.hidden {
    display: none;
}

.popup h2 {
    font-size: 30px;
    text-align: center;
    color: var(--text-color);
    margin-bottom: 20px;
}

/* Botão fechar */
.closeButton,
#close-leaderboard-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 20px;
    cursor: pointer;
    background-color: var(--background-color);
    border-radius: 5px;
    color: black;
    z-index: 97;
    width: 50px;
    height: 50px;
    border: 2px solid var(--azul-clarinhofofo);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid black;
}

/* Conteúdo do popup do leaderboard */
.leaderboard-content {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.popup-header {
    display: flex;
    justify-content: center;
    align-items: center;

    position: relative;
}

/* Filtros inspirados no Seja Veloz */
.filtros_container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 1000px;
    margin: 0 auto 20px auto;
 
}

.filtros_container input[type="text"] {
    width: 100%;
    padding: 12px 60px 12px 12px;
    border: 2px solid black;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: white;
    color: #333;
}

.filtros_container input[type="text"]:focus {
    outline: none;
}

.results-count {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid black;
    padding: 2px 4px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    pointer-events: none;
    display: none;
    min-width: 20px;
    text-align: center;
}

.results-count.show {
    display: block;
}

#toggle-advanced-filters {
    min-width: 50px;
    border: 2px solid black;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    padding: 12px;

}

#clear-filters {
    border: 2px solid black;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    padding: 12px 16px;
    white-space: nowrap;
}

.filtros-avancados {
    display: none;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}
.form-group i{
    margin-right: 3px;
}

.form-group i:last-child{
    margin-right: 0px;
}

.form-group {
    position: relative;
    display: flex;
    width: 100%;
}

.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid black;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: white;
    color: #333;
}

.form-group input[type="date"]:focus,
.form-group select:focus {
    outline: none;
    border-color: black;
}

.form-group label {
    position: absolute;
    left: 12px;
    top: 12px;
    font-size: 16px;
    color: #999;
    background-color: white;
    padding: 0 5px;
    transition: all 0.3s ease;
    pointer-events: none;
}

.form-group input[type="date"]:focus+label,
.form-group input[type="date"]:not(:placeholder-shown)+label,
.form-group input[type="date"]:valid+label,
.form-group select:focus+label,
.form-group select:not([value=""])+label {
    top: -8px;
    left: 12px;
    font-size: 12px;
    color: black;
    font-weight: bold;
}

/* Responsividade para telas menores */
@media (min-width: 600px) {
    .filtros-avancados {
        flex-direction: row;
      
    }

    .form-group {
        flex: 1;
    }
}

@media (max-width: 500px) {
    .filtros-avancados {
        flex-direction: column;
    }
}

/* Animações para feedback dos filtros */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Estilo para o +N do placar ao ganhar pontos */
.score-delta {
    pointer-events: none;
    will-change: transform, opacity;
    text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Minimal style for score popup */
/* dark minimal score popup */
#score-popup {
    /* darker overlay just for score popup */
    background-color: rgba(6, 10, 18, 0.66);
    display: flex;
    justify-content: center;
    align-items: center;
}

#score-popup .popup-content {
    max-width: 420px;
    width: 100%;
    background: white;
    display: flex;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#score-popup.popup.hidden { display: none; }

#score-popup .final-score-display p{
    margin: 0;
    font-size: 36px;
    font-weight: 700;
    display:flex;
    align-items: center;
    gap: 10px;
}

/* accent for the heart icon / score icon */
#score-popup .final-score-display p i { color: #ff6b6b; font-size: 1em; }

#score-popup input#player-name-input{
    width: 100%;
    padding: 10px 12px;
    border-radius: 5px;
    border: 2px solid black;
    background: rgba(255,255,255,0.03);
    box-sizing: border-box;
    font-size: large;
}

#score-popup input#player-name-input::placeholder{ color: rgba(0, 0, 0, 0.5); }

#score-popup .popup-buttons{
    width: 100%;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Live score flash for gains/losses */
#live-score.score-gain {
    color: #48bb78; /* green */
    transform: scale(1.12);
    transition: color 200ms ease, transform 200ms ease;
}

#live-score.score-loss {
    color: #f56565 !important; /* red */
    transform: scale(0.96);
    transition: color 200ms ease, transform 200ms ease;
}


/* LEADER BOARD ----------------------------------------------------------------------*/

.leaderboard-section-title{
    text-align: left;
    padding-top: 20px; /* space above the colored block */
    background: transparent; /* inner element will carry the color */
}

 .leaderboard-section-inner {
    font-weight: bold;
     box-sizing: border-box;
     padding: 8px 16px; /* padding inside the block */
     padding-right: 0;
     width: 100%;
     display: flex; /* place text and bar on the same line */
     align-items: center;
     gap: 12px;
     background: transparent;
     color: #000; /* ensure title text stays black */
 }

/* decorative line removed; background color applied directly to inner */

.leaderboard-table{
    width: 100%;
    text-align: center;
    /* Remove gaps between cells so background on header fills fully */
    border-collapse: collapse;
    border-spacing: 0;
    /* allow rounded corners to show when cells have radius */
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 30px;
}

.leaderboard-nome{
    text-align: left;
}
 
.leaderboard-header .leaderboard-nome{
    padding-left: 0;
}

/* Prevent long text from widening the columns */
.leaderboard-table th, .leaderboard-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-header th  {
    background-color: #c0deff;
        padding: 8px 2px; 
}

.leaderboard-header th:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 0px;
}

.leaderboard-header th:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 0px;
}

/* Per-section color stored in a custom property. The background is kept transparent
   and a colored bar is shown under the text via .leaderboard-section-inner::after */
tr#hard-section { --section-color: #ff9b9b; }
tr#medium-section { --section-color: #ffe19b; }
tr#easy-section { --section-color: #99ff99; }
tr#veryeasy-section { --section-color: #8bc1ff; }
tr#overall-section { --section-color: #cc96ff; }

/* Draw a colored bar under the section title instead of filling the whole background */
.leaderboard-section-inner::after {
    content: "";
    display: block;
    height: 4px; /* thickness of the colored line */
    flex: 1 1 auto; /* allow the bar to grow and fill remaining horizontal space */
    background: var(--section-color, transparent);
  
    min-width: 30px; /* keep a visible bar even when space is tight */
    pointer-events: none;
}

/* Special layout for the overall score: centered text with lines on both sides */
tr#overall-section .leaderboard-section-inner {
    justify-content: center; /* center the text */
    gap: 16px; /* spacing between text and the side lines */
}

tr#overall-section .leaderboard-section-inner::before {
    content: "";
    display: block;
    height: 4px;
    flex: 1 1 auto;
    background: var(--section-color, transparent);

    min-width: 30px;
    pointer-events: none;
}

/* ensure the existing ::after also uses the same sizing for symmetry (overrides global if needed) */
tr#overall-section .leaderboard-section-inner::after {
    content: "";
    display: block;
    height: 4px;
    flex: 1 1 auto;
    background: var(--section-color, transparent);
    min-width: 30px;
    pointer-events: none;
}

#overall-section .leaderboard-section-inner{
padding-left: 0;
}

.leaderboard-row:nth-child(even) {
    background-color: #f8fbff;
}

.leaderboard-row:nth-child(odd) {
    background-color: #f1f7ff;
}

.leaderboard-row td {
    padding: 4px 0;
}


/* Top-3 styling per difficulty */
.coresdaoras.rank-1  {
    background-color: #ffd050;
    font-weight: bold;
}
.coresdaoras.rank-2  {
   background-color: white;
   font-weight: bold;
}
.coresdaoras.rank-3  {
    background-color: #ffa94d;
    font-weight: bold;
}

/* Highlight para novo score adicionado */
.highlight-new-score {
    animation: highlightPulse 2s ease-in-out;
    z-index: 10;
    position: relative;
}

@keyframes highlightPulse {
    0% {
        background: #ffed4a;
    }
    25% {
        background: #fffeed;
    }
    50% {
        background: #ffed4a;
    }
    75% {
        background: #fffeed;
    }
    100% {
        background: #ffed4a;
    }
}

/* Alerta de score baixo (similar ao Seja Veloz) */
#customAlertNoScore {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 10px 0 0 0;
    transition: all 0.3s ease;
    text-align: center;
}

#customAlertNoScore.show {
    max-height: 100px;
    height: 100%;
    opacity: 1;
}

.custom-alert-noscore {
    color: #3b82f6;
    font-weight: bold;
    font-size: 14px;
    animation: fadeInOut 3s ease-in-out;
}

.custom-alert-noscore i {
    margin-right: 5px;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Mensagens de conexão online/offline */
.connection-message {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding-bottom: 0;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    text-align: center;
    margin: 5px;
}

.connection-message.show {
    max-height: 100px;
    height: 100%;
    opacity: 1;
}

.offline-msg {
    color: #ef4444;
}

.online-msg {
    color: #10b981;
}


