/* Variáveis CSS para cores e fontes */
:root {
  --citra-purple: #6a3d9a;
  --citra-dark: #1a1a2e;
  --citra-light: #f8f9fa;
  --citra-accent: #9c6ad6; /* Um roxo mais claro para acentuar */
  --text-shadow-light: 0 0 10px rgba(0, 0, 0, 0.7); /* Sombra para texto em cores claras */
}

/* Base global */
body {
  background-color: var(--citra-dark);
  color: var(--citra-light);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  padding: 2rem;
  margin: 0; /* Garante que não haja margem padrão do body */
  box-sizing: border-box; /* Inclui padding e borda na largura total dos elementos */
  display: flex; /* Usado para o controle de visibilidade mobile */
  flex-direction: column; /* Usado para o controle de visibilidade mobile */
  min-height: 100vh; /* Garante que o body ocupe a altura total da viewport */
}

/* Cabeçalho */
header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--citra-purple), #4a148c);
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: flex; /* Permite centralizar os itens de forma flexível */
  justify-content: center;
  align-items: center; /* Centraliza verticalmente os itens no header */
  gap: 1rem; /* Espaçamento entre os logos e o h1 */
}

header img {
  height: 80px;
}

h1 {
  font-size: 2.8rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin: 0; /* Remove margem padrão do h1 para melhor controle com flex/gap */
}

/* Seções gerais (intro, filters) */
.intro, .filters {
  background: rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.intro h2 {
  color: var(--citra-accent);
  text-align: center;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 2rem;
}

/* Tabela de chaves de rating */
.rating-key {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  overflow: hidden;
}

.rating-key th, .rating-key td {
  padding: 0.8rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rating-key th {
  background-color: var(--citra-purple);
  color: white;
  font-weight: bold;
}

.rating-key tbody tr:last-child td {
  border-bottom: none;
}

/* Estilos para as estrelas de compatibilidade */
.s5 { background-color: #4dd0d4; text-shadow: var(--text-shadow-light); } /* Cyan */
.s4 { background-color: #8bc34a; text-shadow: var(--text-shadow-light); } /* Verde claro */
.s3 { background-color: #ffc107; text-shadow: var(--text-shadow-light); } /* Amarelo */
.s2 { background-color: #ff9800; text-shadow: var(--text-shadow-light); } /* Laranja */
.s1 { background-color: #f44336; text-shadow: var(--text-shadow-light); } /* Vermelho */
.s0 { background-color: #000000; color: white; text-shadow: none;} /* Preto para unplayable */


/* FILTROS E BARRA DE PESQUISA - FOCO NA REVISÃO */
.filters-section {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Espaçamento entre os elementos dentro da seção de filtros (search-bar, h3, filter-bar) */
}

/* Estilos para os novos h3 dentro da seção de filtros */
.filters-section h3 {
    color: var(--citra-accent); /* Cor de destaque */
    font-size: 1.2rem;
    margin-top: 1.5rem; /* Espaçamento acima do h3 */
    margin-bottom: 0.8rem; /* Espaçamento abaixo do h3 e acima dos botões */
    text-align: left; /* Alinha o texto do h3 à esquerda */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Linha divisória sutil */
    padding-bottom: 0.5rem;
}

.search-bar {
    width: 100%;
    /* margin-bottom: 1rem; Removido, já há gap no filters-section */
}

.search-bar input {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--citra-light);
    font-size: 1rem;
    box-sizing: border-box;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.search-bar input:focus {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 2px var(--citra-accent);
    outline: none;
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.filter-bar, .emulator-filter {
    display: flex;
    flex-wrap: wrap; /* Permite que os botões quebrem a linha se não houver espaço */
    gap: 0.5rem; /* Espaçamento entre os botões */
    width: 100%;
    /* GARANTINDO ALINHAMENTO À ESQUERDA: */
    justify-content: flex-start; /* **EXPLÍCITO: ALINHA OS ITENS AO INÍCIO DO CONTAINER FLEX** */
    margin-bottom: 1rem; /* Espaçamento entre os grupos de botões */
}

/* Remover margin-bottom do último grupo de botões (ou do último elemento que você queira sem margem) */
.filters-section .emulator-filter:last-of-type { /* Mais específico para o último .emulator-filter dentro de .filters-section */
    margin-bottom: 0;
}

.filter-bar button, .emulator-filter button {
    background-color: var(--citra-purple);
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.filter-bar button:hover, .emulator-filter button:hover {
    background-color: var(--citra-accent);
    transform: translateY(-2px);
}

.filter-bar button.active, .emulator-filter button.active {
    background-color: var(--citra-accent);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.current-filters {
    text-align: center; /* Mantém a mensagem de "Showing:" centralizada */
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1.5rem; /* Espaçamento acima da mensagem de filtros atuais */
}

.current-filters span {
    font-weight: bold;
    color: var(--citra-accent);
}

/* Tabela de Compatibilidade Principal */
.compatibility {
  width: 100%;
  border-collapse: collapse;
  margin-top: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  overflow: hidden;
}

.compatibility th, .compatibility td {
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  box-sizing: border-box;
}

.compatibility thead th {
  background-color: var(--citra-purple);
  color: white;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Ajustes para a segunda linha de cabeçalhos */
.compatibility thead tr:nth-child(2) th {
    background-color: #5a2e8c;
    font-size: 0.9em;
    padding-top: 8px;
    padding-bottom: 8px;
}

.compatibility tbody tr {
  background-color: rgba(255, 255, 255, 0.03);
  transition: background-color 0.2s ease;
}

.compatibility tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.compatibility tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.01);
}

.compatibility td a {
  color: var(--citra-accent);
  text-decoration: none;
}

.compatibility td a:hover {
  text-decoration: underline;
}

/* Classe para células de estrelas */
.stars {
  font-weight: bold;
  text-align: center;
}

/* Aviso de "nenhum resultado" */
#no-results-message {
    text-align: center;
    color: var(--citra-accent);
    font-size: 1.3rem;
    margin-top: 2rem;
    padding: 1.5rem;
    border: 2px dashed var(--citra-accent);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: none;
}

#no-results-message p {
    margin: 0.5rem 0;
}

/* Rodapé */
footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

footer a {
  color: var(--citra-accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------- */
/* MEDIA QUERIES E AVISO DE ORIENTAÇÃO PARA MOBILE */
/* ---------------------------------------------------- */

/* Estilos para o aviso de orientação */
#orientation-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    color: white;
    font-size: 1.5rem;
    text-align: center;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    pointer-events: none;
}

#orientation-warning h2 {
    color: white;
    margin-bottom: 1rem;
    font-size: 2em;
}

#orientation-warning img {
    height: 100px;
    margin-top: 20px;
}

#orientation-warning p {
    margin: 10px 0;
}


/* Celas pequenas E ORIENTAÇÃO VERTICAL (PORTRAIT) */
@media screen and (max-width: 800px) and (orientation: portrait) {
    body {
        overflow: hidden;
    }

    #orientation-warning {
        display: flex;
        opacity: 1;
        pointer-events: auto;
    }

    header, main, footer {
        opacity: 0;
        pointer-events: none;
    }
}

/* Telas grandes OU ORIENTAÇÃO HORIZONTAL (LANDSCAPE) */
@media screen and (min-width: 801px), screen and (orientation: landscape) {
    body {
        overflow: auto;
    }

    #orientation-warning {
        display: none;
        opacity: 0;
        pointer-events: none;
    }

    header, main, footer {
        opacity: 1;
        pointer-events: auto;
        display: block;
    }
}


/* Responsividade geral da tabela para telas menores (fora do aviso de orientação) */
@media screen and (max-width: 1200px) {
    .compatibility {
        overflow-x: auto;
    }
    .compatibility table { /* Nota: esta regra pode não ser necessária, pois .compatibility já é a tabela */
        width: auto;
        min-width: 800px;
    }
}

/* Ajustes para telas muito pequenas no geral (independentemente da orientação, se a tabela estiver visível) */
@media screen and (max-width: 600px) {
    body {
        padding: 1rem;
    }
    h1 {
        font-size: 2rem;
    }
    header img {
        height: 60px;
    }
    .intro h2, .filters-section h2 {
        font-size: 1.5rem;
    }
    .filter-bar button, .emulator-filter button {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    .compatibility th, .compatibility td {
        padding: 8px 10px;
        font-size: 0.9em;
    }
    #orientation-warning {
        font-size: 1.2rem;
    }
    #orientation-warning h2 {
        font-size: 1.8em;
    }
}