:root {
    --black-body: #2a2a2a;
    --screen-color: #a7b7a6;
    --confirm-color: #5cb85c;
    --cancel-color: #d9534f;
    --help-color: #f0ad4e;
    --highlight-border: #00ffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 75vh;
    background-color: #1a1a1a;
    font-family: Arial, sans-serif;
    overflow: hidden; /* Evita scroll innecesario */
}

.device-container {
    width: 95vw; 
    max-width: 360px; 
    height: 92vh; 
    max-height: 800px; 
    background-color: var(--black-body);
    border-radius: 35px; 
    border: 3px solid #cfcfcf;
    padding: 15px; /* Reducido para dar más espacio interno */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.screen {
    width: 100%;
    flex: 0 0 40%; /* Un poco menos de la mitad */
    background-color: var(--screen-color);
    border: 5px solid #000;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 7px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

#screen-text {
    font-size: 1.5rem; /* Tamaño ajustado para evitar desborde de texto */
    font-weight: 900;
    color: #000;
    text-align: center;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* GRILLA DE BOTONES CORREGIDA */
.buttons-grid {
    width: 100%;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columnas iguales */
    grid-template-rows: repeat(3, 1fr);    /* 3 filas iguales */
    gap: 5px; /* Espacio reducido para evitar que se salgan */
    padding: 5px 0;
}

.button {
    width: 100%;
    height: 100%; /* Ocupa el espacio de la celda */
    max-height: 80px; /* Evita que crezcan demasiado en pantallas largas */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.80rem; /* Letra un poco más pequeña para que quepa el texto */
    font-weight: bold;
    border-radius: 50%; /* Mantiene la forma redonda */
    cursor: pointer;
    color: #fff;
    text-align: center;
    border: 2px solid rgba(0,0,0,0.4);
    box-shadow: 0 4px 0 #000;
    transition: all 0.2s;
    text-transform: uppercase;
    padding: 5px; /* Espacio interno para que el texto no toque el borde */
}

.button:active {
    transform: translateY(8px);
    box-shadow: 0 1px 0 #000;
}

/* Colores */
.function { background-color: #434785; border-color: var(--highlight-border); }
.si { background-color: var(--confirm-color); color: #000; }
.no { background-color: var(--cancel-color); color: #fff; }
.abs { background-color: var(--help-color); color: #000; }
.exit { background-color: #2196f3; }
.quorum { background-color: #434785; font-size: 0.80rem; }
.blank { visibility: hidden; }

.footer-logo {
    color: #ede7e7;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 3px;
    margin-top: auto;
}