@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Estilos gerais */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #3b2e36;
    color: #e5e5e5;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}

body::before {
    content: 'ゴゴゴゴ';
    position: fixed;
    font-size: 20rem;
    color: rgba(255, 215, 0, 0.06);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    font-weight: bold;
}

header {
    text-align: center;
    margin: 20px 0;
}

.header {
    text-align: center;
    margin-bottom: 50px;
    padding-top: 40px;
}

.btn {
    background: #141414;
    border: 1px solid #2a2a2a;
    color: #e5e5e5;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    border-color: #9400D3;
    background: #1a1a1a;
    transform: translateY(-2px);
}

.title {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF1493 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -2px;
    position: relative;
}

/* Acento sutil em vez de estrelas grandes */
.title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #FFD700, transparent);
}

.subtitle {
    font-size: 1rem;
    color: #737373;
    font-weight: 400;
    margin-bottom: 30px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-badge {
    background: #141414;
    border: 1px solid #2a2a2a;
    color: #e5e5e5;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Efeito hover sutil mas com cor JoJo */
.stat-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.1), transparent);
    transition: left 0.5s ease;
}

.stat-badge:hover::before {
    left: 100%;
}

.stat-badge:hover {
    border-color: #FFD700;
    transform: translateY(-2px);
}

main {
    width: 90%;
    max-width: 800px;
}

/* * ==========================================
 * CSS DO AUTOCOMPLETE (A PARTE CRÍTICA)
 * ==========================================
*/

/* * 1. O PAI DE POSICIONAMENTO
 * Este é o novo 'div' que contém o input E as sugestões.
 * 'position: relative' é a chave.
*/
.guess-container {
    position: relative;
    margin-bottom: 10px;
}

/* 2. A SECÇÃO DO INPUT */
.guess-section {
    display: flex;
    gap: 10px;
}

#guess-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* 3. O CONTAINER DAS SUGESTÕES */
#autocomplete-suggestions {
    /* Posicionamento absoluto EM RELAÇÃO ao '.guess-container' */
    position: absolute; 
    
    /* Ponto de Ajuste 1: 'top'
       Ajuste este valor para que a caixa comece 
       logo abaixo do seu input (ex: 40px, 42px) */
    top: 40px; 
    
    left: 0;
    
    /* Ponto de Ajuste 2: 'width'
       Ajuste esta 'calc' para que a caixa tenha 
       a mesma largura do input. (100% - largura_do_botão - gap) */
    width: calc(100% - 105px); 
    
    background-color: white;
    border: 1px solid #ccc;
    border-top: none; /* Evita borda dupla com o input */
    border-radius: 0 0 5px 5px;
    max-height: 200px;
    overflow-y: auto;
    
    /* Um z-index alto é bom para garantir que flutue por cima */
    z-index: 1000; 
}

/* 4. CADA ITEM DE SUGESTÃO */
.suggestion-item {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    color: #333;
    border-bottom: 1px solid #eee;
}

.suggestion-item:hover {
    background-color: #f0f0f0;
}

/* ==========================================
 * RESTO DOS ESTILOS
 * ==========================================
*/

#guess-button, #hint-button {
    background: #141414;
    border: 1px solid #2a2a2a;
    color: #e5e5e5;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}
#guess-button:hover, #hint-button:hover {
    border-color: #9400D3;
    background: #1a1a1a;
    transform: translateY(-2px);
}
#hint-button {
    background-color: #17a2b8;
    width: 100%;
    margin-top: 10px;
}

#feedback-text {
    color: red;
    text-align: center;
    min-height: 1.2em;
    font-size: 0.9em;
}

/* Grid de Resultados */
.results-header, .result-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr 1fr 1.5fr; 
    gap: 5px;
    text-align: center;
    margin-bottom: 5px;
    align-items: center;
}

.result-cell {
    padding: 8px;
    border-radius: 3px;
    color: white;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.results-header .header-cell {
    font-weight: bold;
    background-color: #e9ecef;
    color: #333;
}

.cell-character {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 5px;
}

.char-image {
    width: 40px;
    height: 40px;
    object-fit: scale-down; /* Smaller of contain or original size */
    border-radius: 50%;
    border: 2px solid white;
}

/* Cores das pistas */
.correct { background-color: #28a745; }
.incorrect { background-color: #dc3545; }
.partial {
    background-color: #ffc107;
    color: #333;
}

.character-gallery-div{
  display: flex; /* Makes the container a flex container */
  justify-content: space-around; /* Distributes space between items */
  align-items: flex-start;
}

/* =========================================
      7. GALERIA DE CARTÕES (Extra)
      ========================================= */
   .character-gallery h2 {
       font-size: 1.5rem;
       font-weight: 700;
   }
   
   #character-cards-container {
       display: grid;
       grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
       gap: 15px;
   }
   
   .character-card {
       background: #141414;
       border: 1px solid #2a2a2a;
       border-radius: 12px;
       padding: 15px;
       text-align: center;
       transition: transform 0.2s;
   }
   
   .character-card:hover {
       transform: translateY(-5px);
       border-color: #FFD700;
   }
   
   .character-card img {
       width: 80px;
       height: 80px;
       object-fit: cover;
       object-position: top center;
       border-radius: 50%;
       margin-bottom: 10px;
       border: 2px solid #333;
   }
   
   .character-card p {
       font-size: 0.9rem;
       color: #e5e5e5;
       font-weight: 600;
   }

/* ==========================================
 * ESTILOS DE RESPONSIVIDADE (MEDIA QUERIES)
 * ==========================================
*/

@media (max-width: 768px) {
    /* 1. Ajustes Gerais de Layout */
    body {
        /* Remove o texto grande de fundo em telas pequenas */
        background-attachment: scroll; 
    }

    body::before {
        font-size: 10rem; /* Reduz o tamanho do 'ゴゴゴゴ' */
        opacity: 0.05;
    }

    main {
        width: 95%; /* Usa mais espaço horizontal em telas pequenas */
        padding: 0 10px; /* Adiciona um pequeno padding nas laterais */
    }

    /* 2. Ajustes de Tipografia */
    .title {
        font-size: 3rem; /* Reduz o título principal */
    }

    .subtitle {
        font-size: 0.9rem;
    }

    /* 3. Ajustes do Input e Botões */
    .guess-section {
        flex-direction: column; /* Coloca o input e o botão um em cima do outro */
        gap: 5px;
    }

    /* O botão agora fica em sua própria linha e ocupa toda a largura */
    #guess-button {
        width: 100%;
        margin-top: 5px;
    }
    
    /* Ajusta a largura do container de sugestões após mudar o layout do input */
    .guess-container {
        margin-bottom: 20px;
    }

    /* O elemento de sugestões deve se alinhar à nova largura */
    #autocomplete-suggestions {
        /* O topo é ajustado porque o layout do input/botão mudou */
        top: 45px; 
        left: 0;
        /* A largura agora é 100% do .guess-container, pois o botão está em outra linha */
        width: 100%; 
    }

    /* 4. O Ponto Mais Crítico: Reestruturação do Grid de Resultados */
    .results-header, .result-row {
        /* Muda o layout do grid para exibir apenas 3 colunas por linha */
        grid-template-columns: 1fr 1fr 1fr; 
        
        /* Aumenta um pouco o espaçamento */
        gap: 10px;
        margin-bottom: 10px;
        padding: 10px;
        /* Adiciona um fundo para agrupar as células de cada tentativa */
        background-color: #141414; 
        border: 1px solid #2a2a2a;
        border-radius: 10px;
    }

    /* Esconde as células que não cabem no layout de 3 colunas.
       Vamos exibir as informações na ordem de:
       Personagem, Idade, Parte, Stand (na 2ª linha)
    */

    /* Estilos para a segunda linha de informações (Gênero e Stand) */
    .result-row::after {
        content: attr(data-secondary-info);
        grid-column: 1 / -1; /* Ocupa todas as colunas da linha */
        text-align: left;
        padding: 8px;
        font-size: 0.8em;
        color: #a3a3a3;
        background-color: #1a1a1a;
        border-radius: 5px;
    }

    .result-cell {
        min-height: auto;
        padding: 6px;
    }

    .results-header {
        /* Esconde o cabeçalho original (Nome, Idade, Parte, Stand)
           porque o formato do grid agora é confuso. 
           O cabeçalho é menos importante em telas pequenas.
        */
        display: none; 
    }
}