:root {
    --black-body: #2a2a2a;
    --screen-color: #b6b3b3;
    --confirm-color: #0f9311;
    --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;
    /* CAMBIO: Usamos 'dvh' (Dynamic Viewport Height) si es posible, 
       esto ayuda en celulares a ignorar la barra de direcciones del navegador */
    height: 100vh; 
    height: 100dvh; 
    background-color: #6e6d6d;
    font-family: Arial, sans-serif;
    overflow: hidden; 
}

.device-container {
    width: 95vw; 
    max-width: 360px; 
    height: 85vh; 
    max-height: 800px; 
    background-color: var(--black-body);
    border-radius: 35px; 
    border: 6px solid #cfcfcf;
    padding: 17px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    
    /* === EL TRUCO PARA SUBIRLO === */
    /* Esto mueve todo el control 30 pixeles hacia arriba desde el centro */
    margin-top: -10px; 
}

/* 1. Ajuste del contenedor de la pantalla */
.screen {
    width: 100%;
    flex: 0 0 45%; /* Le damos un poquito más de espacio a la pantalla */
    background-color: var(--screen-color);
    border: 5px solid #000;
    border-radius: 12px;
    display: flex;
    justify-content: flex-start; /* Alinea al inicio (arriba) */
    align-items: flex-start;    /* Alinea al inicio (izquierda) */
    padding: 15px;              /* Más espacio interno */
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
    overflow-y: auto;           /* ¡IMPORTANTE! Si la lista es larga, permite bajar con el dedo */
}

/* 2. Ajuste del texto de la pregunta/listado */
#screen-text {
    /* Bajamos el tamaño: 2rem es gigante para listas. 1.2rem es perfecto */
    font-size: 1.2rem; 
    font-weight: 700;
    color: #000;
    text-align: left;           /* Alineado a la izquierda */
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;      /* Respeta los saltos de línea del admin */
    line-height: 1.5;           /* Más espacio entre renglones para que no se amontone */
    display: block;             /* Cambiamos de flex a block para mejor lectura de listas */
    width: 100%;
    word-wrap: break-word;      /* Rompe palabras largas si es necesario */
}

.buttons-grid {
    width: 100%;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    grid-template-rows: repeat(3, 1fr);    
    gap: 5px; 
    padding: 5px 0;
}

.button {
    width: 100%;
    height: 100%; 
    max-height: 80px; 
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.80rem; 
    font-weight: bold;
    border-radius: 45%; 
    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; 
}

.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;
}

 /* Esta clase solo se activará para los listados de preguntas */
.modo-lista {
    text-align: left !important;
    padding-left: 20px !important;
    white-space: pre-wrap !important; /* Respeta los saltos de línea */
    line-height: 1.4 !important;
}

/* Forzamos que el PIN y otros textos sigan centrados por defecto */
#display-area {
    text-align: center; 
    width: 100%;
}
    