html, body {
    height: 100%; margin: 0; padding: 0; overflow: hidden;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background-color: #fce4ec;
    display: flex; justify-content: center; align-items: center;
}

#app-container {
    display: flex; flex-direction: column; width: 90vw;
    max-width: 1600px; height: 95vh; padding: 2vh;
    box-sizing: border-box; gap: 2vh; border-radius: 20px;
    background-color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.shake-error { animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); display: flex;
    justify-content: center; align-items: center; z-index: 1000;
}
.modal-box {
    background-color: #fff; border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    padding: 30px 40px; max-width: 600px;
    text-align: center;
}

/* --- ESTILOS PARA LA VENTANA DE CRÉDITOS --- */
#credits-box h2 { color: #3f51b5; }
#uni-logo { border-radius: 50%; margin-bottom: 15px; border: 3px solid #003366; height: 150px; width: 150px; }
#credits-box h3 { margin-bottom: 10px; }
#credits-box ul { list-style: none; padding: 0; margin-bottom: 20px; }
#credits-box li { margin-bottom: 5px; }
#close-credits-btn {
    background-color: #95a5a6;
    display: block; margin: 20px auto 0; padding: 10px 30px;
    font-size: 1.1em; font-family: 'Comic Sans MS', cursive, sans-serif;
    color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: bold;
}

#report-box { text-align: left; }
#report-summary { display: flex; justify-content: space-around; font-size: 1.2em; }
#report-exercise-list {
    list-style: none; padding: 0; max-height: 200px; overflow-y: auto;
    border: 1px solid #ccc; border-radius: 8px; padding: 10px;
}
#report-exercise-list li { margin-bottom: 5px; }
#report-exercise-list .correcto { color: #2ecc71; }
#report-exercise-list .incorrecto { color: #e74c3c; }
#print-report-btn, #close-report-btn {
    display: inline-block; margin: 20px 10px 0; padding: 10px 20px;
    font-size: 1em; font-family: 'Comic Sans MS', cursive, sans-serif;
    color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: bold;
}
#print-report-btn { background-color: #3498db; }
#close-report-btn { background-color: #95a5a6; }

#name-input {
    display: block; width: 80%; margin: 20px auto; padding: 10px;
    font-size: 1.2em; font-family: 'Comic Sans MS', cursive, sans-serif;
    border: 2px solid #90caf9; border-radius: 8px;
}
#start-game-btn, #close-instructions-btn {
    display: block; margin: 20px auto 0; padding: 10px 30px;
    font-size: 1.1em; font-family: 'Comic Sans MS', cursive, sans-serif;
    background-color: #4CAF50; color: white; border: none;
    border-radius: 8px; cursor: pointer; font-weight: bold;
}

#instruction-modal-box { text-align: left; }
#instruction-modal-box h2 { text-align: center; color: #4CAF50; margin-top: 0; }
#instruction-modal-box ul { list-style-type: '✅'; padding-left: 25px; }
#instruction-modal-box li { padding-left: 10px; margin-bottom: 10px; }

#felicitaciones-box {
    background-color: #ff9800; color: white; font-size: 4em;
    font-weight: bold; padding: 40px 80px;
    display: flex; flex-direction: column; align-items: center;
    border: 5px dashed #4caf50;
}
#ejercicio-resuelto {
    font-size: 0.5em; font-weight: normal; margin-top: 20px;
    padding: 10px 20px; background-color: rgba(255,255,255,0.3);
    border-radius: 10px; color: #333;
}
.hidden { display: none !important; }

.header {
    display: flex; justify-content: space-between; align-items: center;
    background-color: #4CAF50; color: white; padding: 1.5vh 2vw;
    font-size: 1.5em; font-weight: bold; border-radius: 15px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
    text-shadow: 2px 2px #388e3c; flex-shrink: 0;
}
#player-name-display {
    font-size: 0.8em; font-weight: normal; background-color: rgba(255,255,255,0.2);
    padding: 5px 15px; border-radius: 10px;
}
#score-display {
    font-size: 0.8em; font-weight: normal; display: flex; gap: 20px;
}
.score-item {
    background-color: rgba(255,255,255,0.2); padding: 5px 15px; border-radius: 10px;
}

#main-container {
    display: flex; width: 97%; gap: 2vw; background-color: #fff9c4;
    padding: 2vh; border-radius: 20px; box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border: 3px solid #ffd54f; flex-grow: 1; min-height: 0;
}
#counters-palette {
    width: 28vh; display: flex; flex-wrap: wrap; align-content: flex-start;
    gap: 1vh; padding: 1.5vh; background-color: #e0f2f7;
    border-right: 2px dashed #90caf9; overflow-y: auto; border-radius: 15px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}
#mackinder-grid {
    flex-grow: 1; display: grid; grid-template-rows: repeat(3, 1fr);
    gap: 2vh;
}
.grid-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2vh; }
.middle-row { grid-template-columns: 1fr 2fr 1fr; }

.box {
    border: 3px solid #5d4037; background-color: #ffffff; display: flex;
    flex-wrap: wrap; align-content: flex-start; gap: 5px;
    padding: 1.5vh; border-radius: 12px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative; overflow: hidden;
}
.grid-box {
    background-image: radial-gradient(#e0e0e0 10%, transparent 10%),
                      radial-gradient(#e0e0e0 10%, transparent 10%);
    background-size: 20px 20px; background-position: 0 0, 10px 10px;
    background-color: #f7f7f7; transition: all 0.2s ease-in-out;
}
.box.over { border: 3px dashed #FFD700; background-color: #fffacd; }

#central-box { background-color: #ffcdd2; border-color: #e57373; }
#central-box.highlight {
    border: 4px solid #F44336; background-color: #ffcdd2;
    box-shadow: 0 0 15px #F44336; animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); box-shadow: 0 0 15px #F44336; }
    to { transform: scale(1.02); box-shadow: 0 0 25px #F44336; }
}

.counter {
    width: 4.5vh; height: 4.5vh; border-radius: 50%;
    cursor: grab; flex-shrink: 0; box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.5); transition: transform 0.1s ease-out;
}
.counter:active { transform: scale(1.1); }
.counter.is-dragging { opacity: 0.7; transform: scale(0.9); }

.counter.color-1 { background-color: #EF5350; }
.counter.color-2 { background-color: #42A5F5; }
.counter.color-3 { background-color: #66BB6A; }
.counter.color-4 { background-color: #FFCA28; }
.counter.color-5 { background-color: #AB47BC; }
.counter.color-6 { background-color: #FF7043; }
.counter.color-7 { background-color: #26A69A; }
.counter.color-8 { background-color: #78909C; }
.counter.color-9 { background-color: #FF5722; }
.counter.color-10{ background-color: #D32F2F; }

#controls {
    margin-top: 0; display: flex; gap: 1.5vw;
    align-items: flex-end; justify-content: center; flex-shrink: 0;
}

/* --- CÓDIGO RESTAURADO --- */
#controls button {
    padding: 1.2vh 2vw; font-size: 1.1em; cursor: pointer; border: none;
    color: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease; font-weight: bold; text-transform: uppercase;
}
#instrucciones-btn { background-color: #ffb300; }
#instrucciones-btn:hover { background-color: #ffa000; transform: translateY(-2px); }
#finalizar-btn { background-color: #9b59b6; }
#finalizar-btn:hover { background-color: #8e44ad; transform: translateY(-2px); }
#comprobar-btn { background-color: #8BC34A; }
#comprobar-btn:hover { background-color: #689F38; transform: translateY(-2px); }
#reset-btn { background-color: #F44336; }
#reset-btn:hover { background-color: #D32F2F; transform: translateY(-2px); }
#creditos-btn { background-color: #3f51b5; }
#creditos-btn:hover { background-color: #303f9f; transform: translateY(-2px); }
/* --- FIN DEL CÓDIGO RESTAURADO --- */


.input-group {
    display: flex; flex-direction: column; align-items: flex-start;
}
.input-group label {
    margin-bottom: 0.8vh; font-size: 1.1em; font-weight: bold;
    color: #3f51b5;
}
.input-group input[type="text"] {
    width: 250px; max-width: 100%; padding: 1.2vh; font-size: 1.1em;
    border-radius: 8px; border: 2px solid #90CAF9;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
