body { 
    background-color: #0f172a; 
    color: white; 
    font-family: 'Courier New', monospace; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    margin: 0;
    overflow: hidden;
    transition: background-color 0.3s ease; /* Para el efecto de error */
}

/* Clase para el efecto visual de error */
body.error-flash {
    background-color: #450a0a;
}

.game-container { text-align: center; width: 100%; padding: 10px; box-sizing: border-box; }

.header { 
    display: flex; 
    justify-content: space-around; 
    font-size: 1.2rem; 
    font-weight: bold; 
    margin-bottom: 10px; 
}
#level-display { color: #60a5fa; }
#lives-display { color: #ef4444; letter-spacing: 5px; }

.board { 
    display: flex; 
    justify-content: center;
    gap: 15px; 
    background: #1e293b; 
    padding: 30px 15px; 
    border-radius: 15px; 
    margin: 20px auto;
    max-width: fit-content;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.digit { 
    display: grid; 
    grid-template-columns: 12px 45px 12px; 
    grid-template-rows: 12px 45px 12px 45px 12px; 
    gap: 2px;
}

.digit.hidden { display: none; }

.slot { 
    background: rgba(255, 255, 255, 0.05); 
    border-radius: 2px; 
    position: relative;
}

.stick {
    background: #f97316;
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    z-index: 10;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.2s;
}

.stick:active { cursor: grabbing; }

.dragging-mobile {
    position: fixed !important;
    pointer-events: none;
    z-index: 1000;
    transform: scale(1.15); /* Aumentamos un poco para verlo bajo el dedo */
    opacity: 0.9;
}

/* Formas de los palitos usando clip-path */
.horizontal .stick { clip-path: polygon(15% 0, 85% 0, 100% 50%, 85% 100%, 15% 100%, 0 50%); }
.vertical .stick { clip-path: polygon(50% 0, 100% 15%, 100% 85%, 50% 100%, 0 85%, 0 15%); }

/* Posicionamiento en el grid */
.top { grid-area: 1/2; } 
.tl  { grid-area: 2/1; } 
.tr  { grid-area: 2/3; } 
.mid { grid-area: 3/2; }
.bl  { grid-area: 4/1; } 
.br  { grid-area: 4/3; } 
.bot { grid-area: 5/2; }

#target-display { font-size: 1.6rem; color: #fff; margin: 10px 0; text-transform: uppercase; }
#score-board { font-size: 1.4rem; color: #fbbf24; margin-bottom: 20px; }
#current-val { font-weight: bold; background: #000; padding: 2px 10px; border-radius: 4px; border: 1px solid #fbbf24; }

.reset-btn { 
    padding: 12px 30px; 
    background: #334155; 
    color: white; 
    border: none; 
    border-radius: 8px; 
    font-family: inherit;
    font-weight: bold;
    cursor: pointer; 
    transition: background 0.2s;
}

.reset-btn:hover { background: #475569; }
.reset-btn:active { transform: translateY(2px); }

/* ... (mantenemos tu CSS anterior y agregamos/modificamos esto) ... */

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.action-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.check { background: #10b981; color: white; }
.check:hover { background: #059669; transform: scale(1.05); }

.reset { background: #334155; color: white; }
.reset:hover { background: #475569; }

.action-btn:active { transform: translateY(2px); }

/* Palito base (apagado) */
.stick {
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.1; /* Muy transparente cuando está apagado */
    background: #475569;
}

/* Palito encendido */
.stick.active {
    opacity: 1;
    background: #f97316;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.8);
}

/* Hover para que el usuario sepa que puede hacer click */
.stick:hover {
    opacity: 0.5;
}

.stick.active:hover {
    opacity: 0.8;
}

#moves-display {
    color: #fbbf24;
    font-weight: bold;
    font-size: 1.1rem;
    background: rgba(0,0,0,0.3);
    padding: 2px 10px;
    border-radius: 5px;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.header {
    align-items: center; /* Centrar elementos verticalmente */
}

#moves-display {
    transition: all 0.3s ease;
    padding: 5px 15px;
    border-radius: 20px;
}

.moves-warning {
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
    border: 1px solid #fbbf24;
}

.moves-danger {
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    border: 1px solid #ef4444;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}