:root {
    --bg-color: #141414;
    --card-bg: #2b2b2b;
    --focus-border: #eee;
    --text-color: #fff;
    --accent-color: #00a8e1;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 2vh 4vw; /* Padding relativo à altura/largura da tela */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100vh;
}

h2 {
    font-size: 1.5rem;
    color: #888;
    margin-bottom: 1.5vh;
    margin-left: 10px;
    text-transform: uppercase;
    font-weight: 700;
}

/* Container Principal */
.app-container {
    display: flex;
    flex-direction: column;
    gap: 4vh; /* Espaço vertical flexível */
    width: 100%;
    max-width: 1600px; /* Limite para telas ultra-wide */
    margin: 0 auto;
}

/* Linhas (Shelves) */
.row {
    display: flex;
    flex-direction: row;
    gap: 1.5vw; /* Espaço horizontal flexível */
    overflow-x: auto;
    padding: 10px 5px; /* Padding extra para o foco não cortar */
    scroll-behavior: smooth;
    align-items: center; /* Centraliza verticalmente */
}

.row::-webkit-scrollbar { display: none; }

/* --- BOTÕES RESPONSIVOS --- */
.Optotipos-Btn {
    background-color: var(--card-bg);
    border: none;
    border-radius: 12px;
    
    /* Tamanho base relativo à altura da tela (vh) para manter proporção */
    width: 18vh; 
    height: 14vh;
    min-width: 140px; /* Mínimo para não quebrar */
    min-height: 110px;
    max-width: 220px; /* Máximo para não ficar gigante */
    max-height: 160px;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s;
    flex-shrink: 0; /* Impede que o botão encolha se faltar espaço */
}

/* Ícones dentro do botão */
.Optotipos-Btn img {
    height: 45%; /* Ocupa 45% da altura do botão */
    width: auto;
    margin-bottom: 10%;
    filter: invert(1);
    object-fit: contain;
}

/* Ícones especiais (Bicromático) */
.Optotipos-Btn div[style*="border-radius"] {
    width: 4vh !important;
    height: 4vh !important;
    margin-bottom: 10%;
}

/* Texto do botão */
.Optotipos-Btn h1 {
    font-size: 2.2vh; /* Fonte escala com a altura da tela */
    font-weight: 500;
    margin: 0;
    color: #ccc;
    text-align: center;
    white-space: nowrap; /* Evita quebra de linha */
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90%;
}

/* Estado de Foco */
.Optotipos-Btn.selected, .Optotipos-Btn:focus {
    transform: scale(1.1);
    background-color: #444;
    box-shadow: 0 0 2vh rgba(255, 255, 255, 0.4);
    outline: 3px solid var(--focus-border);
    z-index: 10;
}

.Optotipos-Btn.selected h1 {
    color: #fff;
    font-weight: bold;
}

/* Header de Distância */
.header-info {
    position: absolute;
    top: 3vh;
    right: 4vw;
    background: #333;
    padding: 1vh 2vw;
    border-radius: 30px;
    font-size: 2.5vh;
    border: 1px solid #555;
    z-index: 20;
}

/* --- AJUSTES PARA TELAS MENORES (Tablets/Laptops pequenos) --- */
@media (max-width: 1024px) {
    .Optotipos-Btn {
        width: 16vh;
        height: 14vh; /* Aumentado levemente */
    }
    h2 { font-size: 1.2rem; }
}

/* Ajuste específico para Celulares / Telas Estreitas */
@media (max-width: 768px) {
    .app-container {
        padding-bottom: 20px;
    }
    
    .row { 
        gap: 15px; /* Gap fixo para não grudar */
        padding: 10px 15px; /* Mais area de scroll */
    }

    .Optotipos-Btn {
        width: 130px;      /* Largura fixa segura */
        height: 140px;     /* Altura fixa segura para caber texto */
        min-width: 130px;
        min-height: 140px;
    }

    .Optotipos-Btn h1 {
        font-size: 14px; /* Tamanho legível fixo */
        white-space: normal; /* Permite quebra de linha se precisar */
        line-height: 1.1;    /* Melhor espaçamento */
        width: 95%;
    }
    
    .Optotipos-Btn img {
        height: 40%;
        margin-bottom: 8px;
    }

    .Optotipos-Btn div[style*="border-radius"] {
        width: 40px !important;
        height: 40px !important;
    }
}

@media (max-height: 600px) {
    .app-container { gap: 2vh; }
    .row { gap: 1vw; }
    .Optotipos-Btn {
        height: 18vh;
        width: 22vh;
        min-height: 100px; /* Garante mínimo mesmo em landscape */
    }
    .Optotipos-Btn h1 {
        font-size: 2.5vh;
    }
}